Skip to main content
{
  "status": "success",
  "company_id": 1,
  "company_name": "Demo Company",
  "cognivo_code": "COGNIVO_DEMO",
  "agents": [
    {
      "id": 5,
      "name": "Sales Agent",
      "description": "Agent specialized in sales and customer service"
    },
    {
      "id": 8,
      "name": "Support Agent",
      "description": "Agent for technical support and problem resolution"
    }
  ],
  "total_agents": 2
}

Agents

Retrieve all active agents for a specific company using company ID and Cognivo code.

Endpoint

POST /api/v1/agent/get_by_company

Authentication

Bearer Token RequiredThe token must be valid for agent endpoint and POST method.
Authorization: Bearer <your_token_here>

Input Parameters

Body Parameters

company_id
integer
required
Unique identifier of the company
code
string
required
Cognivo code of the company (must be non-empty)

Responses

{
  "status": "success",
  "company_id": 1,
  "company_name": "Demo Company",
  "cognivo_code": "COGNIVO_DEMO",
  "agents": [
    {
      "id": 5,
      "name": "Sales Agent",
      "description": "Agent specialized in sales and customer service"
    },
    {
      "id": 8,
      "name": "Support Agent",
      "description": "Agent for technical support and problem resolution"
    }
  ],
  "total_agents": 2
}

Example 1: Get company agents

curl -X POST "https://www.cognivo.app/api/v1/agent/get_by_company" \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "company_id": 1,
    "code": "COGNIVO_DEMO"
  }'

Important Considerations

Validations

  • Bearer token must be valid and properly formatted
  • company_id must be a valid integer
  • code must be a non-empty string
  • Company must exist with provided ID and code

Behavior

  • Returns only active agents
  • Agent descriptions are HTML cleaned
  • Results are filtered by company ownership
  • Empty results return valid response with 0 agents

Limits

  • Fast lookup using indexed company fields
  • Efficient agent filtering by active status
  • No specific limit on number of agents returned

Troubleshooting

Solution: Contact your system administrator to verify the company ID and code combination.
Solution: Ensure both company_id and code are included in the request body.
Solution: Check that your Authorization header follows the format: Bearer {token}.
Solution: This is normal if the company has no active agents. Contact your system administrator to verify agent status.
Version: 1.0
Last updated: 2025-01-13
I