← Learn

How to give your AI agent a CRM

Six steps from an empty workspace to an agent that remembers people and tracks deals: mint a key, connect over MCP or REST, read the schema, create records, wire an automation, and bulk-import your existing leads.

An AI agent without a CRM forgets everyone the moment the conversation ends. Giving it one means handing it durable, structured memory it can read and write on its own. With Relm that takes minutes, because the CRM is API-first: the same relm_live_ key drives both a REST API and a native MCP server. Here is the whole path.

Step 1 - Mint a key

Create a workspace in the dashboard and generate an API key. Keys are shown once, SHA-256 hashed at rest, and come in two flavors:

Every request carries the key as a bearer token:

Authorization: Bearer relm_test_xxxxxxxxxxxxxxxxxxxxxxxx

Step 2 - Connect the agent

Pick the transport that matches your agent. Both use the same key.

MCP - for Claude and other MCP-aware clients. Add one block to your mcp.json and restart; the client discovers Relm's tools automatically. Full detail in the MCP CRM server guide.

{
  "mcpServers": {
    "relm": {
      "type": "http",
      "url": "https://api.relmcrm.com/mcp",
      "headers": { "Authorization": "Bearer relm_test_..." }
    }
  }
}

REST - for function-calling agents, scripts, or anything that can make an HTTPS request. Point it at https://api.relmcrm.com/v1 with the bearer header. Nothing else to install.

Step 3 - Read the schema

Before writing, the agent should learn what objects, fields and enum values exist. One call returns the whole self-describing registry:

curl https://api.relmcrm.com/v1/schema \
  -H "Authorization: Bearer relm_test_..."

Reading the schema up front is what keeps the agent honest - it discovers that a deal stage must be one of a specific set, or that contacts support a type enum, instead of guessing. Over MCP the equivalent is the relm_describe_schema tool, which the model calls automatically as its first move.

Step 4 - Create records

Now the agent can write. Create a contact:

curl https://api.relmcrm.com/v1/contacts \
  -H "Authorization: Bearer relm_test_..." \
  -H "Content-Type: application/json" \
  -d '{ "email": "[email protected]", "first_name": "Ada", "last_name": "Lovelace", "type": "lead" }'

{ "id": "con_x8f3k2m9q2", "object": "contact", "email": "[email protected]" }

Then open a deal for that contact in a pipeline and stage. Pipeline and stage both default to the workspace default, so single-pipeline setups stay zero-config:

curl https://api.relmcrm.com/v1/deals \
  -H "Authorization: Bearer relm_test_..." \
  -H "Content-Type: application/json" \
  -d '{ "title": "Analytical Engine expansion", "amount": 20000,
        "pipeline": "sales", "stage": "qualified", "contact": "con_x8f3k2m9q2" }'

If the agent sends a value the workspace does not recognize, the error hands it the fix rather than failing blind:

422 Unprocessable Entity
{
  "type": "unknown_value",
  "title": "Unknown deal stage 'negotiating'",
  "valid_options": ["lead", "qualified", "proposal", "won", "lost"],
  "did_you_mean": "proposal"
}

The agent reads did_you_mean and retries. Need a value that genuinely does not exist yet? Create it at runtime with relm_create_enum_value or relm_create_field instead of forcing a fit. Add an Idempotency-Key header on writes so a retried call returns the original record instead of duplicating it.

Step 5 - Set up an automation

Automations are the CRM doing work while the agent is idle. A rule is a trigger event, optional conditions, and one or more actions - move a deal stage, create an activity, set metadata, or send an email. Wire one so that any won deal logs a follow-up activity:

curl https://api.relmcrm.com/v1/automations \
  -H "Authorization: Bearer relm_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Onboard on win",
    "trigger": "deal.stage_changed",
    "conditions": [{ "field": "stage", "equals": "won" }],
    "actions": [
      { "type": "create_activity", "data": { "kind": "note", "body": "Kick off onboarding" } },
      { "type": "send_email", "data": { "template": "welcome" } }
    ]
  }'

Automations run off Relm's internal event choke point and are depth-guarded against loops. Chain them into drip sequences for multi-step follow-up. Transactional email sends on your own Resend key, and test-mode sends are simulated so nothing reaches a real inbox while you build.

Step 6 - Import your existing leads

To move an existing list in, use the batch endpoint. One round-trip creates many records:

curl https://api.relmcrm.com/v1/batch \
  -H "Authorization: Bearer relm_test_..." \
  -H "Content-Type: application/json" \
  -d '{ "operations": [
    { "method": "create", "object": "contact", "data": { "email": "[email protected]", "first_name": "Ada" } },
    { "method": "create", "object": "contact", "data": { "email": "[email protected]", "first_name": "Bo" } },
    { "method": "create", "object": "company", "data": { "name": "Acme", "domain": "acme.com" } },
    { "method": "create", "object": "deal",    "data": { "title": "Acme", "amount": 12000, "stage": "lead" } }
  ]}'

Over MCP this is the relm_batch tool, and the transport also accepts an array of tool calls in a single POST. Two things to know: each operation is metered individually, so batching saves round-trips rather than quota; and batch imports are event-silent by design - they skip webhooks and automations, so a bulk load will not fire your "Onboard on win" rule a thousand times.

Rehearse in test mode, then go live

Everything above ran against a relm_test_ key, which is the right way to build. Test mode is a fully isolated dataset: it is free, unlimited, invisible to billing and the dashboard, and its email sends are simulated rather than delivered. Let your agent make every mistake here - wrong stages, duplicate contacts, misfired automations - at zero cost and with no risk to real records. When the behavior is solid, swap the key prefix and the identical calls hit live data. Reads use cursor pagination and every record carries a version you can guard with If-Match, so even long-running agents stay consistent under concurrent writes.

You now have an agent with memory

Flip the key from relm_test_ to relm_live_ and the same calls write real data. Your agent can now remember every contact, track every deal across multiple pipelines, and act on changes through automations - all with one bearer key, over REST or MCP. The Free plan covers 1,000 requests a month with no card; see pricing to scale up, browse the agent hub for machine-readable manifests, and keep the docs open as reference.

Give your agent memory today

Mint a free key, connect over MCP or REST, and start writing records.

Start free →