Create an agent

Create a BASIC agent inside the business associated with your API key.

POST/api/external/v2/agents

Authentication

This endpoint authenticates with an API key via the X-API-Key header (ek_live_... format), instead of the bearer token used in the rest of the reference.

Request body

ParameterTypeRequiredDescription
agent.nameStringRequiredAgent display name.
agent.system_promptStringRequiredMain agent prompt.
agent.toolsObjectOptionalOptional agent tool configuration.

Example request

bash
curl -X POST "https://eclectic-api-537143970188.us-central1.run.app/api/external/v2/agents" \
  -H "X-API-Key: ek_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "agent": {
      "name": "Support Agent",
      "system_prompt": "Help customers with clear and concise answers."
    }
  }'

Example response

json
{
  "agent": {
    "id": "4b2f7a1e-0e88-4aa7-bf67-7d0a3e0f5b91",
    "name": "Support Agent",
    "type": "BASIC",
    "system_prompt": "Help customers with clear and concise answers.",
    "tools": {}
  },
  "business_id": "2a4b8d4b-23fa-420a-94c2-cb9a4d2c7fb8"
}

Notes

  • business_id is resolved from the API key and should not be sent in the body.
  • The body must include an agent object. The type is always BASIC, and Eclectic configures the provider and model internally.
  • If you send tools reused from a GET response, documentation-only description fields are ignored when saving.