AI Actions

AI-powered actions for ticket management: auto-tag tickets, generate reply suggestions, summarize conversations, and improve draft text.

The AI Action object

action string

AI action type "auto-tag" | "suggest-reply" | "summarize" | "improve"

result object

Action-specific result data

Endpoints

POST /api/v1/teams/{teamId}/ai

Run AI Action

Try it

Run an AI action. Available actions: auto-tag (tag a ticket), suggest-reply (generate a response), summarize (summarize a conversation), improve (refine draft text). It runs on the team AI key, which is live, so a test key is refused with 400.

Request Body

action string required

Action type

ticketId string

Ticket ID (for auto-tag, suggest-reply, summarize)

text string

Text to improve (for improve action)

Code Examples

bash
curl -X POST "https://www.cstar.help/api/v1/teams/{teamId}/ai" \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"action":"suggest-reply","ticketId":"tkt_abc123"}'

Responses

200 AI result
json
{
  "success": true,
  "data": {
    "object": "ai_result",
    "action": "suggest-reply",
    "result": {
      "suggestion": "Hi Jane, I'd be happy to help with your billing issue. Let me look into that for you right away."
    }
  }
}

409 Idempotency-Key in use: its first request is still running (Retry-After says when to send it again) or it was used on another endpoint
json
{
  "success": false,
  "error": {
    "type": "invalid_request_error",
    "code": "idempotency_key_in_use",
    "message": "A request with this Idempotency-Key is still being processed. Retry after it finishes.",
    "doc_url": "https://www.cstar.help/developers/errors#idempotency_key_in_use",
    "request_id": "req_abc123"
  },
  "meta": {
    "requestId": "req_abc123",
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

422 Idempotency-Key already used within 24 hours for a request with a different body
json
{
  "success": false,
  "error": {
    "type": "invalid_request_error",
    "code": "idempotency_key_reused",
    "message": "The Idempotency-Key was already used for a request with a different body. Generate a new key for this request.",
    "doc_url": "https://www.cstar.help/developers/errors#idempotency_key_reused",
    "request_id": "req_abc123"
  },
  "meta": {
    "requestId": "req_abc123",
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

401 Authentication failed: missing or invalid API key
json
{
  "success": false,
  "error": {
    "type": "authentication_error",
    "code": "invalid_api_key",
    "message": "The API key provided is invalid or has been revoked",
    "doc_url": "https://www.cstar.help/developers/errors#invalid_api_key",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

403 Insufficient permissions: wrong key type or team access
json
{
  "success": false,
  "error": {
    "type": "authentication_error",
    "code": "insufficient_permissions",
    "message": "Your API key does not have permission for this operation",
    "doc_url": "https://www.cstar.help/developers/errors#insufficient_permissions",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

429 Rate limit exceeded
json
{
  "success": false,
  "error": {
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded",
    "message": "Rate limit exceeded. Try again in 60 seconds.",
    "retryAfter": 60,
    "doc_url": "https://www.cstar.help/developers/errors#rate_limit_exceeded",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}