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

# Create

> Create an SLA policy with reply, resolution, or phone answer-time targets. Use when provisioning a workspace or adding a policy for a new team or queue.

At least one of `first_reply_target_seconds`, `next_reply_target_seconds`, `resolution_target_seconds`, or `answer_target_seconds` is required. See [fields](/api-reference/sla-policies#fields) for ranges and the phone answer-time options.

```json theme={"dark"}
{
  "name": "Support line",
  "office_hours_id": "a1b2c3d4-0000-4000-8000-000000000000",
  "answer_target_seconds": 30,
  "answer_target_percent": 75,
  "answer_count_mode": "all_offered",
  "answer_short_abandon_seconds": 5
}
```


## OpenAPI

````yaml post /sla/policies
openapi: 3.1.0
info:
  title: OpenCX API
  description: >

    OpenCX is an AI-powered, all-in-one platform for customer support and
    outbound communications.


    Use this API to manage your OpenCX organization's AI agents, actions,
    conversations, contacts, and more.


    To get started, generate a new API key from the dashboard.


    ## Authentication

    All API endpoints require authentication using a Bearer token. You can
    generate an API key from your OpenCX dashboard.


    ## Rate Limiting

    API requests are rate limited to ensure fair usage. The current limits are:

    - 100 requests per minute for standard endpoints

    - 1000 requests per minute for streaming endpoints


    ## Error Handling

    The API uses standard HTTP status codes and returns detailed error messages
    in the response body.
  version: 1.0-beta
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:8080
    description: Development
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /sla/policies:
    post:
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSlaPolicyDto'
      responses:
        '201':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      org_id:
                        type: string
                      name:
                        type: string
                      office_hours_id:
                        anyOf:
                          - type: string
                            format: uuid
                            pattern: >-
                              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                          - type: 'null'
                      first_reply_target_seconds:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      next_reply_target_seconds:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      resolution_target_seconds:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      answer_target_seconds:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      answer_target_percent:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      answer_count_mode:
                        type: string
                        enum:
                          - all_offered
                          - answered_only
                      answer_short_abandon_seconds:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      created_at:
                        type: string
                      updated_at:
                        type: string
                    required:
                      - id
                      - org_id
                      - name
                      - office_hours_id
                      - first_reply_target_seconds
                      - next_reply_target_seconds
                      - resolution_target_seconds
                      - answer_target_seconds
                      - answer_target_percent
                      - answer_count_mode
                      - answer_short_abandon_seconds
                      - created_at
                      - updated_at
                    additionalProperties: false
                required:
                  - data
                additionalProperties: false
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    CreateSlaPolicyDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/CreateSlaPolicyDtoInput'
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        office_hours_id:
          anyOf:
            - type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            - type: 'null'
        first_reply_target_seconds:
          anyOf:
            - type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: 'null'
        next_reply_target_seconds:
          anyOf:
            - type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: 'null'
        resolution_target_seconds:
          anyOf:
            - type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: 'null'
        answer_target_seconds:
          description: >-
            Phone: callers waiting for a human must be answered within this many
            seconds (office hours only, when the policy has them).
          anyOf:
            - type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: 'null'
        answer_target_percent:
          description: 'Phone: goal for the share of calls answered within the target.'
          anyOf:
            - type: integer
              minimum: 1
              maximum: 100
            - type: 'null'
        answer_count_mode:
          description: >-
            Phone: all_offered counts callers who were never answered as missed;
            answered_only grades answered calls only.
          type: string
          enum:
            - all_offered
            - answered_only
        answer_short_abandon_seconds:
          description: >-
            Phone: leave out callers who hang up within this many seconds of
            waiting.
          anyOf:
            - type: integer
              minimum: 0
              maximum: 9007199254740991
            - type: 'null'
      required:
        - name
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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