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

# Create or update a partner status variant

> Upserts a partner-specific status variant. If a status with the same `id`
already exists for this partner, it will be updated. Otherwise a new status is created.

The `mapped_status` field must be one of the 6 internal categories:
`new`, `open`, `pending`, `hold`, `solved`, `closed`.




## OpenAPI

````yaml openapi.yaml post /reference/status
openapi: 3.1.0
info:
  title: Thalamus Partner API
  description: >
    API for external systems (n8n, Zendesk connectors, etc.) to create and
    manage

    tickets, contacts, organizations, and comments in Thalamus.


    ## Authentication

    All endpoints require a Bearer token in the Authorization header.

    API keys are issued per partner and follow the format
    `nerds_{environment}_{random}`.

    The partner context (partner_uuid) is derived from the API key — no need to
    pass it in the request body.


    ## Conventions

    - All create/update endpoints are idempotent (upsert) — if the `id` already
    exists for the partner, the record is updated.

    - IDs in path parameters and request/response bodies refer to the canonical
    identifiers from the partner's source system (e.g., Zendesk ticket ID).

    - Timestamps use ISO 8601 format.

    - All responses follow `{ success, data?, message?, error? }` shape.

    - POST returns `201` when a new record is created, `200` when an existing
    record is updated.

    - Only provided fields are updated — omitted fields remain unchanged
    (partial update).
  version: 1.3.0
  contact:
    name: Thalamus Engineering
    email: development@nerds.nl
servers:
  - url: https://thalamus.nerds.nl/api/v1/partner
    description: Production
  - url: http://localhost:3001/api/v1/partner
    description: Local development
security:
  - BearerAuth: []
tags:
  - name: Tickets
    description: Create, update, and retrieve tickets
  - name: Comments
    description: Create comments on tickets
  - name: Contacts
    description: Create, update, and retrieve contacts
  - name: Organizations
    description: Create, update, and retrieve organizations
  - name: Tasks
    description: Create task records (callbacks, appointments, etc.)
  - name: References
    description: Manage reference data (statuses, types, groups, categories, agents)
paths:
  /reference/status:
    post:
      tags:
        - References
      summary: Create or update a partner status variant
      description: >
        Upserts a partner-specific status variant. If a status with the same
        `id`

        already exists for this partner, it will be updated. Otherwise a new
        status is created.


        The `mapped_status` field must be one of the 6 internal categories:

        `new`, `open`, `pending`, `hold`, `solved`, `closed`.
      operationId: upsertStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StatusVariantUpsertBody'
      responses:
        '200':
          description: Status variant updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusVariantResponse'
        '201':
          description: Status variant created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusVariantResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    StatusVariantUpsertBody:
      type: object
      required:
        - id
        - label
        - mapped_status
      description: >
        Create or update a partner-specific status variant.

        The `mapped_status` maps this variant to one of the 6 internal
        categories.
      properties:
        id:
          type: string
          minLength: 1
          maxLength: 256
          description: Machine-readable status identifier (unique per partner)
          example: waiting_on_customer
        label:
          type: string
          minLength: 1
          maxLength: 128
          description: Human-readable display label
          example: Waiting on Customer
        mapped_status:
          type: string
          enum:
            - new
            - open
            - pending
            - hold
            - solved
            - closed
          description: Internal category this status maps to
          example: pending
        source_system:
          type: string
          maxLength: 256
          nullable: true
          description: Which CRM or source system this status originates from
          example: freshdesk
        status:
          type: string
          enum:
            - active
            - inactive
          default: active
          description: Set to `inactive` to soft-delete
    StatusVariantResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            uuid:
              type: string
              format: uuid
            id:
              type: string
              example: waiting_on_customer
            label:
              type: string
              example: Waiting on Customer
            status:
              type: string
              enum:
                - active
                - inactive
            mapped_status:
              $ref: '#/components/schemas/MappedStatusCategory'
              nullable: true
        message:
          type: string
          example: Status variant created successfully
    MappedStatusCategory:
      type: object
      description: The internal default category a status variant maps to
      properties:
        uuid:
          type: string
          format: uuid
        value:
          type: string
          description: Category key (new, open, hold, pending, solved, closed)
          example: pending
        label:
          type: string
          example: Pending
        sort_order:
          type: integer
          example: 4
        color:
          type: string
          nullable: true
          description: Hex color for the status pill in the UI
          example: '#8b5cf6'
        description:
          type: string
          nullable: true
          description: Human-readable description of this category
          example: Ticket is pending awaiting response from the ticket requester
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: array
              nullable: true
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
  responses:
    BadRequest:
      description: Invalid request body or parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: INVALID_REQUEST
              message: 'Validation failed: body is required'
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: UNAUTHORIZED
              message: Invalid or revoked API key
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Partner API key (e.g. `nerds_live_a8f3d9k2m5n7p1q4r6t8v0w2x4y6z8`)

````