Skip to content
Docs

Connecting an HTTPS API

A worked example, end to end: a CRM system, one action, one grant, and the request Arc sends.

01The goal

A sales agent should be able to add leads to your CRM, and nothing else: not edit or delete contacts, not read the customer list. The CRM here is an example, at https://api.crm.example.com, with an API-key header. The same steps apply to any HTTPS API.

02Connect the CRM

In your CRM, create an API key that can create contacts. Then in Arc, Systems & Actions → Add system:

  • Name: CRM
  • Base address: https://api.crm.example.com
  • Authentication: API key header, header name X-Api-Key, and the key.
Give this key to Arc only. If the agent also has a working CRM key, it can bypass Arc.

03Define contact:create

In the Actions tab, Define action:

  • Action key: contact:create
  • Description: “Add a new lead or customer to the CRM.” The agent reads this.
  • System: CRM. Resource type: crm_contact.
  • Method and path: POST /v2/contacts
  • Record from the response: id
  • Idempotency header: Idempotency-Key, if your CRM supports one.
[  { "name": "email", "type": "string", "max_length": 254 },  { "name": "name", "type": "string", "max_length": 200 },  { "name": "lifecycle", "type": "string", "enum": ["lead", "customer"] },  { "name": "notes", "type": "string", "required": false, "max_length": 1000 }]

Example

The agent can only fill these four fields, and lifecycle only with lead or customer. It cannot choose the endpoint, the method or any other field.

04Grant it to the agent

  1. 1
    In Authority Management → Create authority grant, choose the sales agent.
  2. 2
    Actions: contact:create only.
  3. 3
    Scope: resource type crm_contact, all resources; on behalf of the organisation.
  4. 4
    Validity: until the end of the quarter, say. Review and create.

05What happens

The agent asks for the action, over MCP or HTTP:

curl
curl https://api.arcintell.org/v1/actions \  -H "Authorization: Bearer $ARC_AGENT_CREDENTIAL" \  -H "Content-Type: application/json" \  -d '{    "request_id": "web-lead-20991",    "action": "contact:create",    "on_behalf_of": { "kind": "organisation" },    "resource": { "type": "crm_contact", "id": "new" },    "purpose": "Add an inbound lead",    "parameters": { "email": "jane@example.com", "name": "Jane Doe", "lifecycle": "lead" }  }'

Example

Arc allows it and sends the CRM exactly this, with the key it holds:

HTTP
POST https://api.crm.example.com/v2/contactsX-Api-Key: <held by Arc>Idempotency-Key: <Arc execution id>Content-Type: application/json{  "email": "jane@example.com",  "full_name": "Jane Doe",  "stage": "lead",  "source": "Arc agent: web-lead-20991"}

Example

The optional notes was not supplied, so it was left out. Arc records the decision, the request and the new contact’s id as evidence. Asked to delete a contact, the same agent is refused with NO_APPLICABLE_GRANT: there is no such action, and no grant for it.

To require a person for some leads, add an organisation policy. Every field of a definition is described in Action definitions.