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

# Post v1sla policies



## OpenAPI

````yaml /api-reference/openapi.json post /v1/sla-policies
openapi: 3.1.0
info:
  title: Aide API
  version: '1'
  description: >-
    Aide's public API. The dashboard, personal access tokens and the MCP server
    all use these endpoints.


    **Authentication.** `Authorization: Bearer oat_…` (a teammate's access
    token) or `Authorization: Bearer aide_live_…` (a workspace API key, created
    by an owner or admin under Settings > Developers). Either is bound to one
    account; every resource is scoped to it, and another account's id answers
    404.


    **API keys** act as the workspace, not as a teammate. Operations that list
    `apiKey` under security accept them; everything else (the session, `me`,
    members, teams, billing, conversations, saved views, notifications, helpdesk
    and widget settings, and API keys themselves) answers 403
    `api_key_not_allowed`. A key with only the `read` scope gets 403
    `insufficient_scope` on writes (every method but `GET`, except `POST
    /v1/knowledge/search`, which only reads). A revoked, expired or unknown key
    answers 401 `invalid_api_key`. Requests are rate limited per key.


    **Webhooks.** Each delivery is a `POST` of the event JSON with
    `Aide-Event-Id`, `Aide-Event-Type`, `Aide-Delivery-Attempt` and
    `Aide-Signature: t=<unix seconds>,v1=<hex>`. `v1` is the HMAC-SHA256 of
    `${t}.${raw body}` keyed with the endpoint secret (`whsec_…`, the whole
    string). For 24 h after a rotation a second `v1`, signed with the previous
    secret, is included; accept the request if any `v1` matches and `t` is
    within 5 minutes. Answer 2xx within 10 s; anything else is retried with
    exponential backoff (8 attempts over about 4 h). An endpoint is disabled
    after 25 failed attempts in a row with no success for 24 h. Deduplicate on
    the event id.


    **Responses.** Successful bodies are wrapped as `{ data }`. Page-numbered
    lists add `metadata`: `total` (exact up to 10,000, then 10,000 with
    `totalIsCapped: true`), `totalIsCapped`, `perPage`, `currentPage`,
    `lastPage` and `hasMore`. `page` runs from 1 to 500, and a page that starts
    past the first 10,000 rows answers 422 `page_too_deep`. `GET
    /v1/conversations` also takes a `cursor` (not with `page`): its
    `metadata.nextCursor` pages on in the same sort without counting, and a
    cursor page has null `total`, `currentPage` and `lastPage`. Message threads
    page with `before` and `meta.nextCursor`.


    **Errors.** Every error is `{ error: { type, code, message, requestId,
    fields? } }`. Validation failures are 422 with one entry per field in
    `fields`.


    **Rate limits.** Throttled routes return `X-RateLimit-Limit` and
    `X-RateLimit-Remaining`; a 429 adds `Retry-After` and `X-RateLimit-Reset`.
servers:
  - url: https://app-api.aide.app
    description: Aide API
security: []
tags:
  - name: Account
  - name: Agent
  - name: AgentEntryPoint
  - name: AgentLinks
  - name: AgentPanelEvent
  - name: AgentPanelSessions
  - name: AgentTestConversation
  - name: Analytics
  - name: ApiKey
  - name: Attachment
  - name: Auth
  - name: Billing
  - name: ChannelActivity
  - name: ChannelConfiguration
  - name: ChannelSettings
  - name: ConnectedApp
  - name: ContactSync
  - name: Conversation
  - name: ConversationAi
  - name: ConversationCustomerContext
  - name: ConversationDraft
  - name: ConversationMacro
  - name: ConversationOrder
  - name: CustomField
  - name: EmailMailbox
  - name: EmailPreferences
  - name: GoogleSessions
  - name: HelpdeskSetting
  - name: Integration
  - name: IntegrationAiAgentRule
  - name: IntegrationSidebar
  - name: Invitation
  - name: KnowledgeCollection
  - name: KnowledgeDocument
  - name: KnowledgeEntity
  - name: KnowledgeSource
  - name: Macro
  - name: Me
  - name: Member
  - name: MessageFeedback
  - name: MessageSender
  - name: Notification
  - name: NotificationChannel
  - name: OauthAuthorization
  - name: Order
  - name: OrderAction
  - name: Plan
  - name: PolicyQuestion
  - name: Product
  - name: ProductPairing
  - name: Proposal
  - name: ReplyTemplate
  - name: RoutingRule
  - name: SavedView
  - name: Scenario
  - name: ScenarioBackfill
  - name: Schedule
  - name: SenderClassification
  - name: SenderRule
  - name: ShopifyStaffLinks
  - name: SlaPolicy
  - name: Team
  - name: Topic
  - name: TopicSuggestion
  - name: WebhookEndpoint
  - name: Widgets
paths:
  /v1/sla-policies:
    post:
      tags:
        - SlaPolicy
      operationId: sla_policy.store
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 120
                enabled:
                  enum:
                    - '1'
                    - 1
                    - 'true'
                    - true
                    - 'on'
                    - '0'
                    - 0
                    - 'false'
                    - false
                appliesTo:
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          field:
                            type: string
                            enum:
                              - channel
                          op:
                            enum:
                              - is
                              - is_not
                          value:
                            enum:
                              - chat
                              - email
                              - gorgias
                              - zendesk
                              - front
                              - whatsapp
                              - messenger
                              - instagram
                        required:
                          - field
                          - op
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          field:
                            type: string
                            enum:
                              - topic
                          op:
                            enum:
                              - is
                              - is_not
                              - in
                          value:
                            anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 64
                              - type: array
                                items:
                                  type: string
                                  minLength: 1
                                  maxLength: 64
                                minItems: 1
                                maxItems: 100
                        required:
                          - field
                          - op
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          field:
                            type: string
                            enum:
                              - topic_confidence
                          op:
                            enum:
                              - gte
                              - lt
                          value:
                            type: number
                            minimum: 0
                            maximum: 1
                        required:
                          - field
                          - op
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          field:
                            type: string
                            enum:
                              - priority
                          op:
                            enum:
                              - is
                              - gte
                          value:
                            enum:
                              - low
                              - normal
                              - high
                              - urgent
                        required:
                          - field
                          - op
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          field:
                            type: string
                            enum:
                              - handoff_reason
                          op:
                            type: string
                            enum:
                              - is
                          value:
                            enum:
                              - customer_asked
                              - low_confidence
                              - guardrail
                              - missing_data
                              - policy
                              - manual
                        required:
                          - field
                          - op
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          field:
                            type: string
                            enum:
                              - business_hours
                          op:
                            enum:
                              - inside
                              - outside
                          value:
                            type: string
                            minLength: 1
                            maxLength: 64
                        required:
                          - field
                          - op
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          field:
                            enum:
                              - customer_orders_count
                              - customer_total_spent
                              - order_value
                          op:
                            enum:
                              - gte
                              - lt
                          value:
                            type: number
                            minimum: 0
                        required:
                          - field
                          - op
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          field:
                            type: string
                            enum:
                              - order_status
                          op:
                            type: string
                            enum:
                              - is
                          value:
                            enum:
                              - unfulfilled
                              - fulfilled
                              - partially_fulfilled
                              - cancelled
                              - refunded
                        required:
                          - field
                          - op
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          field:
                            type: string
                            enum:
                              - subject_or_body
                          op:
                            enum:
                              - contains
                              - matches
                          value:
                            type: string
                            minLength: 1
                            maxLength: 500
                        required:
                          - field
                          - op
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          field:
                            type: string
                            enum:
                              - sender_domain
                          op:
                            enum:
                              - is
                              - is_not
                          value:
                            type: string
                            minLength: 1
                            maxLength: 255
                        required:
                          - field
                          - op
                          - value
                        additionalProperties: false
                  maxItems: 30
                targets:
                  type: object
                  properties:
                    firstResponseMinutes:
                      type:
                        - integer
                        - 'null'
                      minimum: 1
                      maximum: 129600
                    nextResponseMinutes:
                      type:
                        - integer
                        - 'null'
                      minimum: 1
                      maximum: 129600
                    resolutionMinutes:
                      type:
                        - integer
                        - 'null'
                      minimum: 1
                      maximum: 129600
                  required: []
                  additionalProperties: false
                businessHoursOnly:
                  enum:
                    - '1'
                    - 1
                    - 'true'
                    - true
                    - 'on'
                    - '0'
                    - 0
                    - 'false'
                    - false
                scheduleId:
                  type:
                    - string
                    - 'null'
                  minLength: 1
                  maxLength: 64
                aideReplyCountsAsFirstResponse:
                  enum:
                    - '1'
                    - 1
                    - 'true'
                    - true
                    - 'on'
                    - '0'
                    - 0
                    - 'false'
                    - false
                pauseOn:
                  type: array
                  items:
                    enum:
                      - waiting_on_customer
                      - on_hold
                      - snoozed
                  maxItems: 3
                  uniqueItems: true
                imminentThresholdPct:
                  type: integer
                  minimum: 1
                  maximum: 99
                onImminent:
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - assign_team
                          teamId:
                            type: string
                            minLength: 1
                            maxLength: 64
                        required:
                          - type
                          - teamId
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - assign_member
                          memberId:
                            type: string
                            minLength: 1
                            maxLength: 64
                        required:
                          - type
                          - memberId
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - set_priority
                          priority:
                            enum:
                              - low
                              - normal
                              - high
                              - urgent
                        required:
                          - type
                          - priority
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - apply_sla
                          policyId:
                            type: string
                            minLength: 1
                            maxLength: 64
                        required:
                          - type
                          - policyId
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - set_status
                          status:
                            enum:
                              - new
                              - open
                              - waiting_on_customer
                              - on_hold
                              - snoozed
                              - closed
                              - spam
                        required:
                          - type
                          - status
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - mark_spam
                        required:
                          - type
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - notify
                          channel:
                            enum:
                              - email
                              - in_app
                          target:
                            enum:
                              - team
                              - member
                          id:
                            type: string
                            minLength: 1
                            maxLength: 64
                        required:
                          - type
                          - channel
                          - target
                          - id
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - hand_to_aide
                        required:
                          - type
                        additionalProperties: false
                  maxItems: 30
                onBreach:
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - assign_team
                          teamId:
                            type: string
                            minLength: 1
                            maxLength: 64
                        required:
                          - type
                          - teamId
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - assign_member
                          memberId:
                            type: string
                            minLength: 1
                            maxLength: 64
                        required:
                          - type
                          - memberId
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - set_priority
                          priority:
                            enum:
                              - low
                              - normal
                              - high
                              - urgent
                        required:
                          - type
                          - priority
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - apply_sla
                          policyId:
                            type: string
                            minLength: 1
                            maxLength: 64
                        required:
                          - type
                          - policyId
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - set_status
                          status:
                            enum:
                              - new
                              - open
                              - waiting_on_customer
                              - on_hold
                              - snoozed
                              - closed
                              - spam
                        required:
                          - type
                          - status
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - mark_spam
                        required:
                          - type
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - notify
                          channel:
                            enum:
                              - email
                              - in_app
                          target:
                            enum:
                              - team
                              - member
                          id:
                            type: string
                            minLength: 1
                            maxLength: 64
                        required:
                          - type
                          - channel
                          - target
                          - id
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - hand_to_aide
                        required:
                          - type
                        additionalProperties: false
                  maxItems: 30
              required:
                - name
      responses:
        '201':
          description: Created
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/SlaPolicy'
                required:
                  - data
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        default:
          $ref: '#/components/responses/Error'
      security:
        - accessToken: []
components:
  headers:
    X-RateLimit-Limit:
      description: Requests allowed in the current window.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests left in the current window.
      schema:
        type: integer
    Retry-After:
      description: Seconds until the window resets.
      schema:
        type: integer
    X-RateLimit-Reset:
      description: When the window resets.
      schema:
        type: string
        format: date-time
  schemas:
    SlaPolicy:
      type: object
      properties:
        object:
          type: string
          const: sla_policy
        name:
          type: string
        createdAt:
          type:
            - string
            - 'null'
        id:
          type: string
        updatedAt:
          type:
            - string
            - 'null'
        position:
          type: number
        scheduleId:
          type:
            - string
            - 'null'
        enabled:
          type: boolean
        targets:
          type: object
          properties:
            firstResponseMinutes:
              type:
                - number
                - 'null'
            nextResponseMinutes:
              type:
                - number
                - 'null'
            resolutionMinutes:
              type:
                - number
                - 'null'
          required:
            - firstResponseMinutes
            - nextResponseMinutes
            - resolutionMinutes
        aideReplyCountsAsFirstResponse:
          type: boolean
        appliesTo:
          type: array
          items:
            anyOf:
              - type: object
                properties:
                  value:
                    type: string
                  op:
                    type: string
                    enum:
                      - inside
                      - outside
                  field:
                    type: string
                    const: business_hours
                required:
                  - value
                  - op
                  - field
              - type: object
                properties:
                  value:
                    type: string
                    enum:
                      - chat
                      - email
                      - front
                      - gorgias
                      - instagram
                      - messenger
                      - whatsapp
                      - zendesk
                  op:
                    type: string
                    enum:
                      - is
                      - is_not
                  field:
                    type: string
                    const: channel
                required:
                  - value
                  - op
                  - field
              - type: object
                properties:
                  value:
                    type: string
                    enum:
                      - customer_asked
                      - guardrail
                      - low_confidence
                      - manual
                      - missing_data
                      - policy
                  op:
                    type: string
                    const: is
                  field:
                    type: string
                    const: handoff_reason
                required:
                  - value
                  - op
                  - field
              - type: object
                properties:
                  value:
                    type: string
                    enum:
                      - cancelled
                      - fulfilled
                      - partially_fulfilled
                      - refunded
                      - unfulfilled
                  op:
                    type: string
                    const: is
                  field:
                    type: string
                    const: order_status
                required:
                  - value
                  - op
                  - field
              - type: object
                properties:
                  value:
                    type: string
                    enum:
                      - high
                      - low
                      - normal
                      - urgent
                  op:
                    type: string
                    enum:
                      - gte
                      - is
                  field:
                    type: string
                    const: priority
                required:
                  - value
                  - op
                  - field
              - type: object
                properties:
                  value:
                    type: string
                  op:
                    type: string
                    enum:
                      - is
                      - is_not
                  field:
                    type: string
                    const: sender_domain
                required:
                  - value
                  - op
                  - field
              - type: object
                properties:
                  value:
                    type: string
                  op:
                    type: string
                    enum:
                      - contains
                      - matches
                  field:
                    type: string
                    const: subject_or_body
                required:
                  - value
                  - op
                  - field
              - type: object
                properties:
                  value:
                    type: number
                  op:
                    type: string
                    enum:
                      - gte
                      - lt
                  field:
                    type: string
                    const: topic_confidence
                required:
                  - value
                  - op
                  - field
              - type: object
                properties:
                  value:
                    anyOf:
                      - type: array
                        items:
                          type: string
                      - type: string
                  op:
                    type: string
                    enum:
                      - in
                      - is
                      - is_not
                  field:
                    type: string
                    const: topic
                required:
                  - value
                  - op
                  - field
              - type: object
                properties:
                  value:
                    type: number
                  op:
                    type: string
                    enum:
                      - gte
                      - lt
                  field:
                    type: string
                    enum:
                      - customer_orders_count
                      - customer_total_spent
                      - order_value
                required:
                  - value
                  - op
                  - field
        businessHoursOnly:
          type: boolean
        imminentThresholdPct:
          type: number
        onBreach:
          type: array
          items:
            anyOf:
              - type: object
                properties:
                  id:
                    type: string
                  channel:
                    type: string
                    enum:
                      - email
                      - in_app
                  type:
                    type: string
                    const: notify
                  target:
                    type: string
                    enum:
                      - member
                      - team
                required:
                  - id
                  - channel
                  - type
                  - target
              - type: object
                properties:
                  memberId:
                    type: string
                  type:
                    type: string
                    const: assign_member
                required:
                  - memberId
                  - type
              - type: object
                properties:
                  type:
                    type: string
                    const: apply_sla
                  policyId:
                    type: string
                required:
                  - type
                  - policyId
              - type: object
                properties:
                  priority:
                    type: string
                    enum:
                      - high
                      - low
                      - normal
                      - urgent
                  type:
                    type: string
                    const: set_priority
                required:
                  - priority
                  - type
              - type: object
                properties:
                  status:
                    type: string
                    enum:
                      - closed
                      - new
                      - on_hold
                      - open
                      - snoozed
                      - spam
                      - waiting_on_customer
                  type:
                    type: string
                    const: set_status
                required:
                  - status
                  - type
              - type: object
                properties:
                  teamId:
                    type: string
                  type:
                    type: string
                    const: assign_team
                required:
                  - teamId
                  - type
              - type: object
                properties:
                  type:
                    type: string
                    const: hand_to_aide
                required:
                  - type
              - type: object
                properties:
                  type:
                    type: string
                    const: mark_spam
                required:
                  - type
        onImminent:
          type: array
          items:
            anyOf:
              - type: object
                properties:
                  id:
                    type: string
                  channel:
                    type: string
                    enum:
                      - email
                      - in_app
                  type:
                    type: string
                    const: notify
                  target:
                    type: string
                    enum:
                      - member
                      - team
                required:
                  - id
                  - channel
                  - type
                  - target
              - type: object
                properties:
                  memberId:
                    type: string
                  type:
                    type: string
                    const: assign_member
                required:
                  - memberId
                  - type
              - type: object
                properties:
                  type:
                    type: string
                    const: apply_sla
                  policyId:
                    type: string
                required:
                  - type
                  - policyId
              - type: object
                properties:
                  priority:
                    type: string
                    enum:
                      - high
                      - low
                      - normal
                      - urgent
                  type:
                    type: string
                    const: set_priority
                required:
                  - priority
                  - type
              - type: object
                properties:
                  status:
                    type: string
                    enum:
                      - closed
                      - new
                      - on_hold
                      - open
                      - snoozed
                      - spam
                      - waiting_on_customer
                  type:
                    type: string
                    const: set_status
                required:
                  - status
                  - type
              - type: object
                properties:
                  teamId:
                    type: string
                  type:
                    type: string
                    const: assign_team
                required:
                  - teamId
                  - type
              - type: object
                properties:
                  type:
                    type: string
                    const: hand_to_aide
                required:
                  - type
              - type: object
                properties:
                  type:
                    type: string
                    const: mark_spam
                required:
                  - type
        pauseOn:
          type: array
          items:
            type: string
            enum:
              - on_hold
              - snoozed
              - waiting_on_customer
      required:
        - object
        - name
        - createdAt
        - id
        - updatedAt
        - position
        - scheduleId
        - enabled
        - targets
        - aideReplyCountsAsFirstResponse
        - appliesTo
        - businessHoursOnly
        - imminentThresholdPct
        - onBreach
        - onImminent
        - pauseOn
    Error:
      type: object
      description: Every error response, whatever the status (app/exceptions/handler.ts).
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - api_error
                - authentication_error
                - invalid_request_error
                - permission_error
                - rate_limit_error
            code:
              type: string
              description: Stable, machine-readable error code.
            message:
              type: string
            requestId:
              type: string
            fields:
              type: array
              description: Per-field problems, on validation errors.
              items:
                type: object
                properties:
                  field:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                required:
                  - field
                  - code
                  - message
          required:
            - type
            - code
            - message
            - requestId
      required:
        - error
  responses:
    Unauthenticated:
      description: Missing or invalid credentials (`authentication_error`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The credential may not do this (`permission_error`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationFailed:
      description: The request has invalid fields (`validation_failed`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: Rate limited (`too_many_requests`).
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error:
      description: Any other error, in the same envelope.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    accessToken:
      type: http
      scheme: bearer
      bearerFormat: oat_…
      description: An access token, bound to one account.

````

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