> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dezerx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add a ticket member

> Adds another user to the ticket. `force_add` adds them straight away, `send_invite` emails an invitation, `pending` creates a request that staff approve or reject. Send an `Idempotency-Key` header to make retries safe: the first response is stored for 24 hours and replayed with `Idempotent-Replayed: true`.

**Permission:** `tickets.members`



## OpenAPI

````yaml /docs/tickets-api.yaml post /tickets/{ticket}/members
openapi: 3.1.0
info:
  title: Spartan Tickets API
  version: '2026.11'
  description: >-
    Support tickets, replies, members, exports and bulk actions.


    All requests need an API key from **Admin, API** in the `Authorization:
    Bearer <key>` header. Replace `{domain}` with the domain of your Spartan
    installation. Successful responses use the envelope `{"data": ..., "meta":
    {"request_id": ...}}`; errors use `{"error": {"code", "message", "details"},
    "request_id"}`.
servers:
  - url: https://{domain}/api/application
    description: Your Spartan installation
    variables:
      domain:
        default: billing.example.com
        description: Domain of your Spartan installation, without https://
security:
  - bearerAuth: []
tags:
  - name: Tickets
  - name: Replies
  - name: Members
  - name: Export
  - name: Bulk
paths:
  /tickets/{ticket}/members:
    post:
      tags:
        - Members
      summary: Add a ticket member
      description: >-
        Adds another user to the ticket. `force_add` adds them straight away,
        `send_invite` emails an invitation, `pending` creates a request that
        staff approve or reject. Send an `Idempotency-Key` header to make
        retries safe: the first response is stored for 24 hours and replayed
        with `Idempotent-Replayed: true`.


        **Permission:** `tickets.members`
      operationId: addTicketMember
      parameters:
        - name: ticket
          in: path
          required: true
          description: Ticket id.
          schema:
            type: integer
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Any unique string up to 255 characters. Retrying with the same key
            and body replays the first response (header `Idempotent-Replayed:
            true`) instead of running the action twice. The same key with a
            different body returns 409 `idempotency_conflict`.
          schema:
            type: string
            maxLength: 255
          example: suspend-svc-2026-11-16-01
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                user_id:
                  type: integer
                invited_by_user_id:
                  type: integer
                action:
                  type: string
                  enum:
                    - send_invite
                    - force_add
                    - pending
              required:
                - user_id
                - invited_by_user_id
                - action
            example:
              user_id: 193
              invited_by_user_id: 192
              action: pending
      responses:
        '201':
          description: Created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/TicketMember'
                  message:
                    type: string
                    description: Human readable confirmation.
                  meta:
                    $ref: '#/components/schemas/Meta'
                required:
                  - data
                  - meta
              example:
                data:
                  id: 48
                  status: pending
                  notification_preference: subscribed
                  token_expires_at: null
                  user:
                    id: 193
                    name: Liam Walker
                    email: liam.walker@example.com
                    avatar: /assets/default-avatar.png
                message: Ticket member created.
                meta:
                  request_id: f97c17d4-d7d2-4cfc-8844-59fd3b3c3737
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Conflict with the current state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                member_conflict:
                  summary: Already a member
                  value:
                    error:
                      code: member_conflict
                      message: This user already has an active or pending membership.
                      details: {}
                    request_id: 95ebf3bd-dba2-4b87-8ffd-5e7f2accb27e
                member_conflict_1:
                  summary: Owner
                  value:
                    error:
                      code: member_conflict
                      message: The ticket owner is already a member.
                      details: {}
                    request_id: 3f6c2a1e-8b4d-4f7a-9c2e-5d1b7a9e0c42
        '422':
          description: Validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
              examples:
                validation_failed:
                  summary: Invalid input
                  value:
                    error:
                      code: validation_failed
                      message: The request data is invalid.
                      details:
                        user_id:
                          - The user id field is required.
                    request_id: 3f6c2a1e-8b4d-4f7a-9c2e-5d1b7a9e0c42
components:
  schemas:
    TicketMember:
      type: object
      properties:
        id:
          type: integer
          description: Membership id.
        status:
          type: string
          enum:
            - accepted
            - pending
            - invited
            - rejected
        notification_preference:
          type: string
          enum:
            - subscribed
            - unsubscribed
        token_expires_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Invitation expiry for `invited` members.
        user:
          oneOf:
            - $ref: '#/components/schemas/UserReference'
            - type: 'null'
        invited_by:
          type:
            - object
            - 'null'
          properties:
            id:
              type: integer
            name:
              type: string
          description: Ticket show only.
    Meta:
      type: object
      properties:
        request_id:
          type: string
          format: uuid
          description: Request id, also sent in the `X-Request-ID` response header.
      required:
        - request_id
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                Machine readable error code, for example `unauthorized`,
                `forbidden`, `not_found`, `invalid_service_state`.
            message:
              type: string
              description: Human readable explanation.
            details:
              type: object
              properties: {}
              description: Extra context. An empty object for most errors.
              additionalProperties: true
          required:
            - code
            - message
            - details
        request_id:
          type: string
          format: uuid
          description: >-
            Request id. Also returned in the `X-Request-ID` header. Send your
            own with `X-Request-ID` to correlate logs.
      description: Error envelope returned by every failed request.
      required:
        - error
        - request_id
    ValidationError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - validation_failed
              description: Always `validation_failed`.
            message:
              type: string
              description: Always `The request data is invalid.`
            details:
              type: object
              properties: {}
              description: >-
                Map of field name to a list of messages. Nested fields use dot
                notation, for example `ticket_ids.0`.
              additionalProperties:
                type: array
                items:
                  type: string
          required:
            - code
            - message
            - details
        request_id:
          type: string
          format: uuid
          description: Request id.
      description: Returned with HTTP 422 when the body or query string fails validation.
      required:
        - error
        - request_id
    UserReference:
      type: object
      properties:
        id:
          type: integer
          description: User id.
        name:
          type: string
          description: Display name.
        email:
          type: string
          format: email
          description: Email address.
        avatar:
          type:
            - string
            - 'null'
          description: Avatar path or URL.
  responses:
    Unauthorized:
      description: Missing, invalid or inactive API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missing:
              summary: No Authorization header
              value:
                error:
                  code: unauthorized
                  message: Bearer token required.
                  details: {}
                request_id: 9aca26ca-e06f-4725-8e4b-4385d6c03422
            invalid:
              summary: Unknown or inactive key
              value:
                error:
                  code: unauthorized
                  message: Invalid or inactive token.
                  details: {}
                request_id: 8802a669-6f06-453e-a1d8-0b81621167c3
    Forbidden:
      description: >-
        The key lacks the permission for this endpoint, or the request IP is not
        in the key allow list.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            forbidden:
              summary: Missing permission
              value:
                error:
                  code: forbidden
                  message: Insufficient permissions for this action.
                  details: {}
                request_id: 191c51e1-03a3-448e-8df7-3c584be888b0
            ip_not_allowed:
              summary: IP not allowed
              value:
                error:
                  code: ip_not_allowed
                  message: Access denied from this IP address.
                  details: {}
                request_id: 3f6c2a1e-8b4d-4f7a-9c2e-5d1b7a9e0c42
    NotFound:
      description: The resource in the path does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: The requested resource was not found.
              details: {}
            request_id: cccbc627-4fd4-4727-889e-fa727c48792c
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key created in Admin, API. Send it as `Authorization: Bearer <key>`.
        Each key has its own permissions and optional IP allow list.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.