Messages

Messages belong to tickets and represent the conversation thread between agents and customers. Each message has a sender type and optional metadata.

The Message object

id string

Unique message identifier (msg_ prefix)

ticketId string

Parent ticket ID (tkt_ prefix)

content string

Message body text

sender string

Who sent the message "agent" | "customer" | "system"

senderName string

Display name of the sender

isInternal boolean

Whether this is an internal note (not visible to customers)

createdAt datetime

When the message was sent

Endpoints

GET /api/v1/teams/{teamId}/tickets/{ticketId}/messages

List Messages

Try it

Get one page of messages for a ticket (20 by default), oldest first. Internal notes are included. Use page and pageSize to read the rest; pagination.hasMore says when there is more.

Path Parameters

ticketId string required

The parent ticket ID (tkt_ prefix)

Query Parameters

page integer

Page number (default: 1)

pageSize integer

Results per page (default: 20, max: 100)

Code Examples

bash
curl -X GET "https://www.cstar.help/api/v1/teams/{teamId}/tickets/{ticketId}/messages?page=1&pageSize=100" \
  -H "Authorization: Bearer sk_live_your_key"

Responses

200 One page of messages, oldest first
json
{
  "success": true,
  "data": [
    {
      "id": "msg_a1b2c3d4e5f6",
      "ticketId": "tkt_550e8400e29b41d4a716446655440000",
      "content": "I keep getting \"invalid credentials\" when I try to log in.",
      "sender": "customer",
      "senderName": "Jane Smith",
      "isInternal": false,
      "createdAt": "2025-12-10T14:30:00Z"
    },
    {
      "id": "msg_b2c3d4e5f6a7",
      "ticketId": "tkt_550e8400e29b41d4a716446655440000",
      "content": "I'll look into this for you right away.",
      "sender": "agent",
      "senderName": "Bob (Support)",
      "isInternal": false,
      "createdAt": "2025-12-10T14:35:00Z"
    }
  ],
  "pagination": {
    "total": 2,
    "page": 1,
    "pageSize": 20,
    "hasMore": false
  },
  "meta": {
    "requestId": "req_abc123",
    "timestamp": "2025-12-10T14:35:00Z"
  }
}

404 Ticket not found
json
{
  "success": false,
  "error": {
    "type": "not_found_error",
    "code": "resource_not_found",
    "message": "Ticket not found",
    "doc_url": "https://www.cstar.help/developers/errors#resource_not_found",
    "request_id": "req_abc123"
  },
  "meta": {
    "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"
  }
}

POST /api/v1/teams/{teamId}/tickets/{ticketId}/messages

Add Message

Try it

Add a new message to a ticket thread. Fires the ticket.message_added webhook event. The first public reply from an agent moves a new ticket to open and fires ticket.updated.

Requires a secret API key.

Path Parameters

ticketId string required

The parent ticket ID (tkt_ prefix)

Request Body

content string required

Message body text

sender string

Sender type

Default: agent

senderName string

Display name (optional)

messageType string

Use internal for a note visible only to your support team. Omit both privacy options for a public message.

isInternal boolean

Optional boolean alias for messageType. If both options are supplied, they must agree.

Code Examples

bash
curl -X POST "https://www.cstar.help/api/v1/teams/{teamId}/tickets/{ticketId}/messages" \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "I have reset your password. Please try logging in again.",
    "sender": "agent",
    "senderName": "Bob (Support)"
  }'

Responses

201 Message added
json
{
  "success": true,
  "data": {
    "id": "msg_c3d4e5f6a7b8",
    "ticketId": "tkt_550e8400e29b41d4a716446655440000",
    "content": "I've reset your password. Please try logging in again.",
    "sender": "agent",
    "senderName": "Bob (Support)",
    "isInternal": false,
    "createdAt": "2025-12-10T14:45:00Z"
  },
  "meta": {
    "requestId": "req_abc123",
    "timestamp": "2025-12-10T14:45:00Z"
  }
}

404 Ticket not found
json
{
  "success": false,
  "error": {
    "type": "not_found_error",
    "code": "resource_not_found",
    "message": "Ticket not found",
    "doc_url": "https://www.cstar.help/developers/errors#resource_not_found",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

409 Idempotency-Key already used within 24 hours for a different message or endpoint. The same message with the same key returns the saved message.
json
{
  "success": false,
  "error": {
    "type": "invalid_request_error",
    "code": "idempotency_key_in_use",
    "message": "Idempotency-Key already used for a different request",
    "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"
  }
}

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"
  }
}