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

# Create subscriptions

> Create a delivery rule for one practice and one trigger type. A webhook subscription sends encrypted event notifications to an HTTPS endpoint that you control. Create separate subscriptions when you need different practices, triggers, or destinations.

The create response is the only response that includes `secret_key`. Store that key securely and associate it with the returned subscription `id`; your receiver uses both values to select the correct key and decrypt each delivery. If the key is lost or exposed, delete the subscription and create a replacement.

See the [Webhooks and subscriptions guide](/guides/webhooks-and-subscriptions) for receiver headers, Fernet decryption, and the end-to-end workflow.



## OpenAPI

````yaml /openapi/peerlogic-api.json post /api/subscriptions/
openapi: 3.1.0
info:
  title: Peerlogic API
  version: 1.0.0
  description: >-
    Customer-facing API reference for accessing Peerlogic calls, insights,
    conversations, tasks, opportunities, subscriptions, and events.
servers:
  - url: https://api.prod.peerlogic.com
    description: Production
security: []
tags:
  - name: Authentication
    description: Obtain an access token for authenticated API requests.
  - name: Call insights
    description: Call records and aggregate performance insights.
  - name: Transcripts
    description: Transcripts, summaries, sentiment, pauses, and call-purpose details.
  - name: Aimee
    description: Aimee activity, configuration, and performance insights.
  - name: Conversations
    description: Conversation records, messages, and conversation actions.
  - name: Tasks
    description: Customer tasks and task workflow actions.
  - name: Opportunities
    description: Opportunities and follow-up reporting.
  - name: Subscriptions and events
    description: >-
      Create and manage event subscriptions, then inspect event records and
      analytics. For the complete webhook delivery flow, see the Webhooks and
      subscriptions guide.
  - name: Organizations and practices
    description: >-
      Discover the organizations and practices available to the authenticated
      account.
  - name: Contacts and patients
    description: Find contacts and patients for caller recognition and related workflows.
  - name: Appointments
    description: Retrieve appointment history and upcoming appointments for a patient.
  - name: Messaging
    description: Send practice messages, including missed-call recovery outreach.
  - name: Call recordings
    description: Retrieve recording metadata and secure audio URLs for calls.
paths:
  /api/subscriptions/:
    parameters: []
    post:
      tags:
        - Subscriptions and events
      summary: Create subscriptions
      description: >-
        Create a delivery rule for one practice and one trigger type. A webhook
        subscription sends encrypted event notifications to an HTTPS endpoint
        that you control. Create separate subscriptions when you need different
        practices, triggers, or destinations.


        The create response is the only response that includes `secret_key`.
        Store that key securely and associate it with the returned subscription
        `id`; your receiver uses both values to select the correct key and
        decrypt each delivery. If the key is lost or exposed, delete the
        subscription and create a replacement.


        See the [Webhooks and subscriptions
        guide](/guides/webhooks-and-subscriptions) for receiver headers, Fernet
        decryption, and the end-to-end workflow.
      operationId: subscriptions_create
      requestBody:
        content:
          application/json:
            schema:
              required:
                - name
                - practice_id
                - subscription_type
                - trigger
              type: object
              properties:
                description:
                  title: Description
                  description: A customer-defined description of the subscription.
                  type: string
                  maxLength: 255
                  nullable: true
                destination:
                  title: Destination
                  description: >-
                    The HTTPS endpoint that receives webhook deliveries.
                    Required when `subscription_type` is `webhook`.
                  type: string
                  maxLength: 255
                  minLength: 1
                  nullable: true
                extra:
                  title: Extra
                  description: Optional customer-defined value for a webhook subscription.
                  type: string
                  maxLength: 255
                  nullable: true
                name:
                  title: Name
                  description: A customer-defined name for the subscription.
                  type: string
                  maxLength: 128
                  minLength: 1
                practice_id:
                  type: string
                  minLength: 1
                  title: Practice id
                  description: The practice whose events produce deliveries.
                subscription_type:
                  title: Subscription type
                  description: Use `webhook` to deliver events to an HTTPS endpoint.
                  type: string
                  enum:
                    - webhook
                    - email
                    - sms
                    - noop
                trigger:
                  required:
                    - trigger_type
                  type: object
                  properties:
                    trigger_type:
                      title: Trigger type
                      description: The event condition that produces a delivery.
                      type: string
                      enum:
                        - missed_call
                        - missed_call_existing_patient
                        - missed_call_cancellation_reschedule
                        - missed_call_current_appointment
                        - missed_call_non_business
                        - missed_call_business
                        - high_value_missed_call
                        - connected_call
                        - connected_call_existing_patient
                        - connected_call_new_patient
                        - connected_call_high_value
                        - lost_opportunity
                        - lost_opportunity_new_patient
                        - lost_opportunity_existing_patient
                        - lost_opportunity_high_value
                        - aimee_escalation
                        - aimee_booked
                        - aimee_reschedule
                        - aimee_cancellation
                        - aimee_inbound_message
                        - extracted_opportunity
                        - care_task_handed_off
                        - voip_integration_disconnect
                        - ehr_integration_disconnect
                        - fax_inbound_received
                        - fax_outbound_failed
                  description: Condition that produces a delivery for this subscription.
            examples:
              missedCallWebhook:
                summary: Subscribe to missed-call events
                value:
                  name: Missed-call events
                  description: Notify our integration when a call is missed
                  destination: https://partner.example.com/webhooks/peerlogic
                  practice_id: <PRACTICE_ID>
                  subscription_type: webhook
                  trigger:
                    trigger_type: missed_call
        required: true
      responses:
        '201':
          description: >-
            The subscription was created. Webhook responses include a
            `secret_key` that is not returned by later read or list requests.
          content:
            application/json:
              schema:
                required:
                  - name
                  - practice_id
                  - secret_key
                  - subscription_type
                  - trigger
                type: object
                properties:
                  secret_key:
                    title: Secret key
                    description: >-
                      The Fernet key used to decrypt webhook request bodies.
                      Returned only by this create response. Store it securely;
                      it cannot be retrieved or changed later.
                    type:
                      - string
                      - 'null'
                    readOnly: true
                  id:
                    title: Id
                    description: >-
                      The unique subscription ID. Webhook deliveries include
                      this value in `X-Subscription-ID`.
                    type: string
                    readOnly: true
                  is_active:
                    title: Is active
                    description: Whether the subscription can produce deliveries.
                    type: boolean
                    readOnly: true
                  created_at:
                    title: Created at
                    type: string
                    format: date-time
                    readOnly: true
                    description: Time when the subscription was created.
                  modified_at:
                    title: Modified at
                    type: string
                    format: date-time
                    readOnly: true
                    description: Time when the subscription was last changed.
                  system_message:
                    title: System message
                    description: >-
                      A delivery or verification status that may require
                      attention.
                    type:
                      - string
                      - 'null'
                    readOnly: true
                  description:
                    title: Description
                    type: string
                    maxLength: 255
                    nullable: true
                    description: >-
                      Customer-defined explanation of the workflow this
                      subscription supports.
                  destination:
                    title: Destination
                    type: string
                    maxLength: 255
                    minLength: 1
                    nullable: true
                    description: >-
                      Delivery destination. Webhook destinations must be HTTPS
                      URLs.
                  extra:
                    title: Extra
                    type: string
                    maxLength: 255
                    nullable: true
                    description: >-
                      Optional customer-defined value available for webhook
                      subscriptions.
                  name:
                    title: Name
                    type: string
                    maxLength: 128
                    minLength: 1
                    description: Customer-defined name used to identify the subscription.
                  practice_id:
                    type: string
                    minLength: 1
                    title: Practice id
                    description: >-
                      Practice whose activity is evaluated for this
                      subscription.
                  subscription_type:
                    title: Subscription type
                    type: string
                    enum:
                      - webhook
                      - email
                      - sms
                      - noop
                    description: >-
                      Delivery channel used by the subscription. Customer
                      webhook integrations use `webhook`.
                  trigger:
                    required:
                      - trigger_type
                    type: object
                    properties:
                      trigger_type:
                        title: Trigger type
                        type: string
                        enum:
                          - missed_call
                          - missed_call_existing_patient
                          - missed_call_cancellation_reschedule
                          - missed_call_current_appointment
                          - missed_call_non_business
                          - missed_call_business
                          - high_value_missed_call
                          - connected_call
                          - connected_call_existing_patient
                          - connected_call_new_patient
                          - connected_call_high_value
                          - lost_opportunity
                          - lost_opportunity_new_patient
                          - lost_opportunity_existing_patient
                          - lost_opportunity_high_value
                          - aimee_escalation
                          - aimee_booked
                          - aimee_reschedule
                          - aimee_cancellation
                          - aimee_inbound_message
                          - extracted_opportunity
                          - care_task_handed_off
                          - voip_integration_disconnect
                          - ehr_integration_disconnect
                          - fax_inbound_received
                          - fax_outbound_failed
                        description: Supported Peerlogic activity that produces a delivery.
                    description: Condition that produces a delivery for this subscription.
              examples:
                webhookCreated:
                  summary: Webhook subscription created
                  description: Store `secret_key` now. Later reads do not return it.
                  value:
                    id: <SUBSCRIPTION_ID>
                    created_at: '2026-09-15T19:18:09Z'
                    modified_at: '2026-09-15T19:18:09Z'
                    name: Missed-call events
                    description: Notify our integration when a call is missed
                    destination: https://partner.example.com/webhooks/peerlogic
                    extra: null
                    practice_id: <PRACTICE_ID>
                    subscription_type: webhook
                    is_active: true
                    system_message: null
                    trigger:
                      trigger_type: missed_call
                    secret_key: <FERNET_SECRET_KEY>
        '400':
          description: >-
            The request is invalid, duplicates an existing subscription, or
            identifies a practice the authenticated account cannot access.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                description: >-
                  Validation details keyed by the invalid field or grouped under
                  `errors`.
              example:
                errors:
                  - practice_id: Invalid
        '401':
          description: Authentication is required.
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    type: string
                    description: Why authentication failed.
              example:
                detail: '''Authorization'' header is required'
        '403':
          description: >-
            The authenticated account does not have permission to create
            subscriptions.
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                properties:
                  message:
                    type: string
                    description: Why access was denied.
              example:
                message: No permissions assigned to permit access to this endpoint.
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer access token issued by Peerlogic.

````

## Related topics

- [Receive webhook events](/guides/webhooks-and-subscriptions.md)
- [Delete subscriptions](/peerlogic-api-reference/subscriptions-and-events/delete-subscriptions.md)
- [Get subscription](/peerlogic-api-reference/subscriptions-and-events/get-subscription.md)
- [Update subscriptions](/peerlogic-api-reference/subscriptions-and-events/update-subscriptions.md)
- [List subscriptions](/peerlogic-api-reference/subscriptions-and-events/list-subscriptions.md)


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