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

# Create an event subscription

> Binds an exact internal event name to a Definition you own. When a matching event is emitted, the subscription's Definition auto-triggers. A missing or cross-tenant Definition returns 404, never 403.



## OpenAPI

````yaml /openapi.json post /event-subscriptions
openapi: 3.1.0
info:
  title: GetDialed Flows API
  version: 0.1.0
servers:
  - url: https://api.getdialed.ai/flows
    description: Production
  - url: http://localhost:8000
    description: Local development
security: []
paths:
  /event-subscriptions:
    post:
      tags:
        - event-subscriptions
      summary: Create an event subscription
      description: >-
        Binds an exact internal event name to a Definition you own. When a
        matching event is emitted, the subscription's Definition auto-triggers.
        A missing or cross-tenant Definition returns 404, never 403.
      operationId: create_subscription_event_subscriptions_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventSubscriptionCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventSubscriptionResponse'
        '401':
          description: Missing or invalid authentication
          content:
            application/json:
              example:
                detail: Authentication required
        '403':
          description: Admin role required
          content:
            application/json:
              example:
                detail: Admin role required
        '404':
          description: Not found — also returned on cross-tenant access (never 403)
          content:
            application/json:
              example:
                detail: Definition not found
        '422':
          description: Validation error (see body for field details)
          content:
            application/json:
              example:
                detail: Validation error
        '429':
          description: Rate limit exceeded — retry after the Retry-After header
          content:
            application/json:
              example:
                detail: Rate limit exceeded
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    EventSubscriptionCreate:
      properties:
        event_type:
          type: string
          minLength: 1
          title: Event Type
        definition_id:
          type: string
          title: Definition Id
        enabled:
          type: boolean
          title: Enabled
          default: true
      additionalProperties: false
      type: object
      required:
        - event_type
        - definition_id
      title: EventSubscriptionCreate
      description: POST /event-subscriptions body.
      example:
        definition_id: def_a1b2c3d4
        enabled: true
        event_type: call.completed
    EventSubscriptionResponse:
      properties:
        id:
          type: string
          title: Id
        org_id:
          type: string
          title: Org Id
        event_type:
          type: string
          title: Event Type
        definition_id:
          type: string
          title: Definition Id
        enabled:
          type: boolean
          title: Enabled
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - org_id
        - event_type
        - definition_id
        - enabled
        - created_at
        - updated_at
      title: EventSubscriptionResponse
      description: GET response.
      example:
        created_at: '2026-07-09T09:00:00Z'
        definition_id: def_a1b2c3d4
        enabled: true
        event_type: call.completed
        id: evsub_1a2b3c4d5e6f
        org_id: org_e5f6g7h8
        updated_at: '2026-07-09T09:00:00Z'
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    HTTPBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````