AurionAI Docs

Contacts & Companies

Manage contacts and companies in the Aurion CS helpdesk via the API.

Contacts & Companies

The Contacts API (v2) manages end-user identities in the Aurion CS helpdesk. Contacts are the people who submit support requests; companies group contacts by organization.

The contact and company CRUD endpoints live under /api/v2/* and the sync endpoints under /api/v1/contacts/*. An API key reaches only the API-key routes. A dashboard session reaches all of them, gated by tenant RBAC permissions (see Required Scopes).

List Contacts

cURL
curl -X POST "https://apps.aurionai.net/api/v2/contacts/list" \
  -H "X-API-Key: ${AURION_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"limit":10,"search":"smith"}'
Python
import requests

response = requests.post(
    "https://apps.aurionai.net/api/v2/contacts/list",
    headers={"X-API-Key": "itsm_sk_live_xxxx"},
    json={"limit": 10, "search": "smith"},
)
contacts = response.json()
TypeScript
const response = await fetch('https://apps.aurionai.net/api/v2/contacts/list', {
  method: 'POST',
  headers: { 'X-API-Key': 'itsm_sk_live_xxxx', 'Content-Type': 'application/json' },
  body: JSON.stringify({ limit: 10, search: 'smith' }),
})
const contacts = await response.json()

Response:

The list envelope is resource-named (items), not data:

{
  "items": [
    {
      "id": "22222222-2222-4222-8222-222222222222",
      "company_id": "11111111-1111-4111-8111-111111111111",
      "company_name": "Acme Corp",
      "email": "jane@example.com",
      "phone": "+33612345678",
      "client_id": null,
      "external_id": null,
      "first_name": "Jane",
      "last_name": "Smith",
      "role": "IT Manager",
      "locale": "fr",
      "timezone": "Europe/Paris",
      "last_seen_at": "2026-04-01T08:30:00Z",
      "conversation_count": 4,
      "unsubscribed_from_emails": false,
      "custom_attrs": {},
      "tags": ["vip"],
      "created_at": "2026-01-15T10:00:00Z",
      "updated_at": "2026-04-01T08:30:00Z",
      "deleted_at": null
    }
  ],
  "total": 3,
  "limit": 10,
  "offset": 0
}

JSON Body Fields:

Search terms can match phone numbers. Keep all filters in the JSON body; the list endpoint does not accept URL query filters. The body limit is 8 KiB.

ParameterTypeDescription
searchstringSearch by name, email, or phone (max length 256)
company_idstringFilter by company
tagstringFilter by a single tag (max length 100). Single value — no comma-separated multi-tag support.
contact_kindstringFilter by kind: end_user, agent_proxy, or vendor
include_deletedbooleanInclude soft-deleted contacts (default: false)
limitintegerResults per page (default: 50, max: 200)
offsetintegerNumber of results to skip (default: 0)

Create Contact

At least one of email, first_name, last_name, phone, or external_id is required. There is no name field — use first_name / last_name.

curl -X POST "https://apps.aurionai.net/api/v2/contacts" \
  -H "X-API-Key: itsm_sk_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "John",
    "last_name": "Doe",
    "email": "john@example.com",
    "phone": "+33698765432",
    "company_id": "11111111-1111-4111-8111-111111111111",
    "role": "Engineer",
    "locale": "en",
    "timezone": "Europe/Paris",
    "external_id": "crm-1042",
    "client_id": "acct-77",
    "unsubscribed_from_emails": false,
    "tags": ["engineering"],
    "custom_attrs": {}
  }'

Returns 201 Created with the full ContactV2 object (same shape as the list items above).

Accepted body fields: company_id, email (max 255), phone (max 50), phone_region (ISO 3166-1 alpha-2, max 2; used to parse a phone given without a + country code), external_id, first_name (max 100), last_name (max 100), role (max 100), locale (max 10), timezone (max 50), client_id (max 120), unsubscribed_from_emails (default false), tags, custom_attrs.

Error responses:

  • 409 Conflict — { "detail": "..." } when the email (or external_id) already belongs to a contact in this tenant.
  • 422 Unprocessable Entity — Pydantic validation errors, the "at least one of email/first_name/last_name/phone/external_id" requirement, or business-rule violations (FK / constraint failures may return a { "detail": { "business_rule_errors": [...] } }-style body).

Get Contact

curl "https://apps.aurionai.net/api/v2/contacts/22222222-2222-4222-8222-222222222222" \
  -H "X-API-Key: itsm_sk_live_xxxx"

Returns the ContactV2 object, or 404 Not Found ({ "detail": "Contact not found" }).

Update Contact

curl -X PATCH "https://apps.aurionai.net/api/v2/contacts/22222222-2222-4222-8222-222222222222" \
  -H "X-API-Key: itsm_sk_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+33698765432",
    "tags": ["vip", "engineering"]
  }'

All body fields are optional on PATCH; only the provided fields are updated.

A phone without a + country code is parsed with phone_region (ISO 3166-1 alpha-2); without it, such a number is refused with 422.

The at-least-one-identifier rule applies to the resulting contact, not to the request body. Clearing email is fine while the contact still has a phone; a request that would leave the contact with none of email, first_name, last_name, phone or external_id is refused. Fields you omit are untouched and still count.

Error responses:

  • 404 Not Found — { "detail": "Contact not found" }.
  • 409 Conflict — { "detail": "..." } when the new email (or external_id) already belongs to another contact in this tenant.
  • 422 Unprocessable Entity — { "detail": "At least one of email, first_name, last_name, phone, or external_id is required" } when the update would clear the contact's last identifier, plus Pydantic validation errors and business-rule violations.

Delete & Restore Contact

Contacts are soft-deleted (not permanently removed) and can be restored:

Delete
curl -X DELETE "https://apps.aurionai.net/api/v2/contacts/22222222-2222-4222-8222-222222222222" \
  -H "X-API-Key: itsm_sk_live_xxxx"

DELETE returns 204 No Content (empty body) on success, or 404 Not Found if the contact does not exist.

Restore
curl -X POST "https://apps.aurionai.net/api/v2/contacts/22222222-2222-4222-8222-222222222222/restore" \
  -H "X-API-Key: itsm_sk_live_xxxx"

restore returns the restored ContactV2 object, 404 Not Found ({ "detail": "Contact not found or not deleted" }) if the contact is not soft-deleted, or 409 Conflict if restoring would collide with a live contact's email or external_id.

Search Contacts

Multi-field fuzzy lookup (used by the dashboard caller-identification modal):

curl -X POST "https://apps.aurionai.net/api/v2/contacts/search" \
  -H "X-API-Key: itsm_sk_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "jane@example.com",
    "first_name": "Jane",
    "phone": "+33612345678",
    "phone_region": "FR",
    "limit": 10
  }'

Body fields: email (max 320), first_name (max 120), last_name (max 120), phone (max 40), phone_region (ISO 3166-1 alpha-2, max 2), client_id (max 120), limit (default 10, 1–50).

Response:

{
  "results": [
    {
      "id": "22222222-2222-4222-8222-222222222222",
      "first_name": "Jane",
      "last_name": "Smith",
      "email": "jane@example.com",
      "phone": "+33612345678",
      "client_id": null,
      "company_id": "11111111-1111-4111-8111-111111111111",
      "company_name": "Acme Corp"
    }
  ]
}

Contact Activity

Dashboard session only. An API key gets 403 on this endpoint, because it can return conversation data.

View the activity history for a contact — conversation events, field changes, and related metadata:

curl "https://apps.aurionai.net/api/v2/contacts/22222222-2222-4222-8222-222222222222/activity?limit=20" \
  -H "X-API-Key: itsm_sk_live_xxxx"

Query Parameters:

ParameterTypeDescription
activity_typestringFilter by activity type
limitintegerResults per page (default: 50, max: 200)
offsetintegerNumber of results to skip (default: 0)

Response:

{
  "items": [
    {
      "id": "ev_001",
      "conversation_id": "cv_321",
      "conversation_subject": "Laptop won't boot",
      "activity_type": "status_change",
      "actor_id": "us_12",
      "actor_name": "Agent Lee",
      "field_name": "status",
      "old_value": "open",
      "new_value": "resolved",
      "metadata": {},
      "created_at": "2026-04-01T09:00:00Z"
    }
  ],
  "total": 1,
  "limit": 20,
  "offset": 0
}

Contact Attachments

Dashboard session only. An API key gets 403 on this endpoint, because it can return conversation data.

List files attached to a contact's conversations:

curl "https://apps.aurionai.net/api/v2/contacts/22222222-2222-4222-8222-222222222222/attachments?limit=20" \
  -H "X-API-Key: itsm_sk_live_xxxx"

Query Parameters:

ParameterTypeDescription
limitintegerResults per page (default: 50, max: 200)
offsetintegerNumber of results to skip (default: 0)

Response:

{
  "items": [
    {
      "id": "at_900",
      "conversation_id": "cv_321",
      "conversation_subject": "Laptop won't boot",
      "message_id": "msg_55",
      "uploader_id": "22222222-2222-4222-8222-222222222222",
      "uploader_name": "Jane Smith",
      "filename": "screenshot.png",
      "content_type": "image/png",
      "size_bytes": 20480,
      "storage_backend": "local",
      "source": "email",
      "created_at": "2026-04-01T09:05:00Z"
    }
  ],
  "total": 1,
  "limit": 20,
  "offset": 0
}

Companies

Companies group contacts by organization and enable company-level reporting.

List Companies

curl "https://apps.aurionai.net/api/v2/companies?search=acme" \
  -H "X-API-Key: itsm_sk_live_xxxx"

Query Parameters:

ParameterTypeDescription
searchstringSearch by name, domain, industry or plan
tagstringFilter by a single tag (max length 100). Single value — no comma-separated multi-tag support.
include_deletedbooleanInclude soft-deleted companies (default: false)
limitintegerResults per page (default: 50, max: 200)
offsetintegerNumber of results to skip (default: 0)

Response:

The envelope is items (not data); each item is a CompanyV2 object:

{
  "items": [
    {
      "id": "11111111-1111-4111-8111-111111111111",
      "name": "Acme Corp",
      "domain": "acme.com",
      "industry": "Manufacturing",
      "size": "200-500",
      "plan": "enterprise",
      "website": "https://acme.com",
      "logo_url": null,
      "monthly_spend": 1200.0,
      "sla_tier": "gold",
      "tags": ["enterprise"],
      "custom_attrs": {},
      "notes": null,
      "contact_count": 12,
      "conversation_count": 34,
      "created_at": "2026-01-10T10:00:00Z",
      "updated_at": "2026-04-01T08:30:00Z",
      "deleted_at": null
    }
  ],
  "total": 1,
  "limit": 50,
  "offset": 0
}

Search Companies

Each field you send must match (partial, case-insensitive). A request with no search term returns no results. Deleted companies are not returned.

curl -X POST "https://apps.aurionai.net/api/v2/companies/search" \
  -H "X-API-Key: ${AURION_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"name":"acme","domain":"acme.fr","limit":10}'
FieldTypeDescription
name, domain, industry, planstringOptional search terms (max length 255 each)
limitintegerMaximum results (default: 10, max: 50)

The response is {"results": [{"id", "name", "domain", "industry", "plan"}]}.

Create Company

curl -X POST "https://apps.aurionai.net/api/v2/companies" \
  -H "X-API-Key: itsm_sk_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Corp",
    "domain": "acme.com",
    "industry": "Manufacturing",
    "size": "200-500",
    "plan": "enterprise",
    "website": "https://acme.com",
    "sla_tier": "gold",
    "tags": ["enterprise"],
    "custom_attrs": {},
    "notes": "Strategic account"
  }'

name is required (1–255 chars). Returns 201 Created with the CompanyV2 object.

Update Company

curl -X PATCH "https://apps.aurionai.net/api/v2/companies/11111111-1111-4111-8111-111111111111" \
  -H "X-API-Key: itsm_sk_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "tags": ["enterprise", "priority"]
  }'

Delete / Restore Company

Companies are soft-deleted and can be restored:

Delete
curl -X DELETE "https://apps.aurionai.net/api/v2/companies/11111111-1111-4111-8111-111111111111" \
  -H "X-API-Key: itsm_sk_live_xxxx"

DELETE returns 200 OK with the IDs of unlinked contacts (it does not return 204):

{
  "id": "11111111-1111-4111-8111-111111111111",
  "unlinked_contacts": 12
}
Restore
curl -X POST "https://apps.aurionai.net/api/v2/companies/11111111-1111-4111-8111-111111111111/restore" \
  -H "X-API-Key: itsm_sk_live_xxxx"

restore returns the restored CompanyV2 object, or 404 Not Found ({ "detail": "Company not found or not deleted" }).


Contact Sync

Sync contacts from your external CS provider (Freshdesk or Zendesk). These endpoints are under /api/v1/contacts and require a dashboard admin session (require_config_admin) — they are not callable with an API key and are not in the public API-key allowlist.

Trigger Contact Sync

curl -X POST "https://apps.aurionai.net/api/v1/contacts/sync?mode=manual" \
  -H "X-API-Key: itsm_sk_live_xxxx"

Query Parameters:

ParameterTypeDescription
modestringmanual (differential, default) or full (with reconciliation — deactivates stale records)

Response:

{
  "success": true,
  "message": "Contact sync completed",
  "synced": 17,
  "created": 12,
  "updated": 5,
  "deactivated": 0,
  "errors": 0,
  "duration_seconds": 3.42
}

Get Sync Settings

curl "https://apps.aurionai.net/api/v1/contacts/settings" \
  -H "X-API-Key: itsm_sk_live_xxxx"

Response:

{
  "auto_sync_enabled": true,
  "sync_interval_hours": 8,
  "last_synced_at": "2026-04-09T06:00:00Z"
}

When no settings have been saved, the defaults are auto_sync_enabled: false, sync_interval_hours: 24, last_synced_at: null.

Update Sync Settings

curl -X PUT "https://apps.aurionai.net/api/v1/contacts/settings" \
  -H "X-API-Key: itsm_sk_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "auto_sync_enabled": true,
    "sync_interval_hours": 12
  }'

sync_interval_hours must be between 1 and 168 when provided.

Sync History

View recent sync operations and their outcomes. The response wraps the records under entries:

curl "https://apps.aurionai.net/api/v1/contacts/sync-history?limit=10" \
  -H "X-API-Key: itsm_sk_live_xxxx"

limit defaults to 10 (1–50).

Response:

{
  "entries": [
    {
      "id": "sh_001",
      "sync_type": "contact",
      "provider_type": "freshdesk",
      "mode": "manual",
      "started_at": "2026-04-09T06:00:00Z",
      "completed_at": "2026-04-09T06:00:03Z",
      "status": "completed",
      "stats": { "created": 12, "updated": 5 },
      "error_message": null
    }
  ]
}

Contacts vs Requesters

  • Contacts (v2) are identities in the Aurion CS helpdesk — managed via this API
  • Requesters (v1) are identities synced from your external ITSM provider (Freshservice, HaloITSM, etc.)

Both can coexist when running ITSM + CS simultaneously.

  • Conversations — Manage conversations for contacts
  • Custom Fields — Add custom data fields to contacts
  • Webhooks — Subscribe to contact.* events (contact.created, contact.updated, contact.deleted)

API-key routes

These are the only contact and company routes an API key can reach. Each is an exact method and route. Any other route, and HEAD, returns 403.

RouteScope
POST /api/v2/contacts/listcontacts:read
POST /api/v2/contacts/searchcontacts:read
GET /api/v2/contacts/:idcontacts:read
POST /api/v2/contactscontacts:write
PATCH /api/v2/contacts/:idcontacts:write
DELETE /api/v2/contacts/:idcontacts:delete
POST /api/v2/contacts/:id/restorecontacts:delete
GET /api/v2/companiescompanies:read
POST /api/v2/companies/searchcompanies:read
GET /api/v2/companies/:idcompanies:read
POST /api/v2/companiescompanies:write
PATCH /api/v2/companies/:idcompanies:write
DELETE /api/v2/companies/:idcompanies:delete
POST /api/v2/companies/:id/restorecompanies:delete

conversation_count is 0 for a key without conversations:read.

Required Scopes

Contacts and companies use separate resources. A dashboard session is checked against the tenant RBAC permissions below; an API key must hold the same permission as a scope, and reaches only the API-key routes. The v1 sync endpoints require a dashboard admin session (require_config_admin), not a config:* API-key scope.

PermissionEndpoints
contacts:readGET /v2/contacts, GET /v2/contacts/:id, GET /v2/contacts/:id/activity, GET /v2/contacts/:id/attachments, POST /v2/contacts/search
contacts:writePOST /v2/contacts, PATCH /v2/contacts/:id
contacts:deleteDELETE /v2/contacts/:id, POST /v2/contacts/:id/restore
companies:readGET /v2/companies, POST /v2/companies/search, GET /v2/companies/:id
companies:writePOST /v2/companies, PATCH /v2/companies/:id
companies:deleteDELETE /v2/companies/:id, POST /v2/companies/:id/restore
Dashboard admin (require_config_admin)POST /v1/contacts/sync, GET /v1/contacts/settings, PUT /v1/contacts/settings, GET /v1/contacts/sync-history

On this page