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

# Create error code

> Creates an error code in the workspace associated with your API key, or returns the existing one with the same name.

Names match case- and whitespace-insensitively, so `" claim_not_found "` returns an existing `CLAIM_NOT_FOUND`. The response's `created` field says which happened, so callers do not need to list codes first.

To use a code, set its `id` as the value of a node's `error_on_false_message` (BOOL_CONDITION), `selector_error_message` (selector-based nodes) or `error_message` (USER_INTERACTION) parameter, then save the workflow.



## OpenAPI

````yaml workflow-api/workflow-api.yaml post /error-codes
openapi: 3.0.0
info:
  title: Workflow API
  version: 1.0.0
  description: API for managing workflows and their metadata
servers:
  - url: https://api.cloudcruise.com
    description: CloudCruise Platform Production API Server
security:
  - AuthScheme: []
paths:
  /error-codes:
    post:
      summary: Create error code
      description: >-
        Creates an error code in the workspace associated with your API key, or
        returns the existing one with the same name.


        Names match case- and whitespace-insensitively, so `" claim_not_found "`
        returns an existing `CLAIM_NOT_FOUND`. The response's `created` field
        says which happened, so callers do not need to list codes first.


        To use a code, set its `id` as the value of a node's
        `error_on_false_message` (BOOL_CONDITION), `selector_error_message`
        (selector-based nodes) or `error_message` (USER_INTERACTION) parameter,
        then save the workflow.
      operationId: createErrorCode
      parameters:
        - name: cc-key
          in: header
          required: false
          schema:
            type: string
          description: CloudCruise API key for authentication
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ErrorCodeCreatePayload'
      responses:
        '201':
          description: The created error code, or the existing one with the same name
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ErrorCode'
                  - type: object
                    properties:
                      created:
                        type: boolean
                        description: >-
                          `true` if a new code was created, `false` if an
                          existing code with the same name was returned
                    required:
                      - created
        '400':
          description: >-
            Bad request - Invalid payload, blank `error_code`, or missing
            `description`
        '401':
          description: Unauthorized - Invalid or missing authentication
        '500':
          description: Internal server error
components:
  schemas:
    ErrorCodeCreatePayload:
      type: object
      properties:
        error_code:
          type: string
          maxLength: 100
          description: >-
            Name of the error code. Must not be blank; leading and trailing
            whitespace is trimmed.
          example: CLAIM_NOT_FOUND
        description:
          type: string
          description: Short description of the error
          example: The claim number was not found in the payer portal
        enriched_description:
          type: string
          description: Longer description used to classify errors against this code
        error_action:
          type: string
          enum:
            - alert
            - cancel
            - pause
            - retry
            - input_required
          description: What CloudCruise does when a run fails with this code
        retries:
          type: integer
          minimum: 0
          description: Number of retries when `error_action` is `retry`
        retry_after:
          type: integer
          minimum: 0
          description: Seconds to wait between retries when `error_action` is `retry`
      required:
        - error_code
        - description
    ErrorCode:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier. Use this value in a node's error-code parameter.
        error_code:
          type: string
          description: Name of the error code, e.g. `CLAIM_NOT_FOUND`
        description:
          type: string
          nullable: true
          description: Short description of the error
        enriched_description:
          type: string
          nullable: true
          description: Longer description used to classify errors against this code
        error_action:
          type: string
          nullable: true
          enum:
            - alert
            - cancel
            - pause
            - retry
            - input_required
          description: What CloudCruise does when a run fails with this code
        retries:
          type: integer
          nullable: true
          description: Number of retries when `error_action` is `retry`
        retry_after:
          type: integer
          nullable: true
          description: Seconds to wait between retries when `error_action` is `retry`
        workspace_id:
          type: string
          format: uuid
          description: ID of the workspace this error code belongs to
        created_at:
          type: string
          format: date-time
          description: Timestamp when the error code was created
  securitySchemes:
    AuthScheme:
      type: apiKey
      name: cc-key
      in: header
      description: >-
        API key-based authentication. Provide your CloudCruise API key in the
        cc-key header.

````