openapi: 3.1.0 info: title: Postscript API description: | The Postscript API enables developers to manage SMS subscribers, send custom events, and configure webhooks for the Postscript SMS marketing platform. This OpenAPI definition captures a representative subset of the public v2 API. Derived from https://developers.postscript.io/. version: "2.0.0" contact: name: Postscript url: https://developers.postscript.io servers: - url: https://api.postscript.io description: Postscript production API security: - BearerAuth: [] tags: - name: Subscribers description: Manage SMS subscribers. - name: Events description: Send custom events for use in flows and triggers. - name: Webhooks description: Configure webhook subscriptions for Postscript events. paths: /api/v2/subscribers: get: tags: [Subscribers] summary: List subscribers description: Returns a paginated list of SMS subscribers. operationId: listSubscribers parameters: - name: cursor in: query schema: type: string - name: limit in: query schema: type: integer default: 50 responses: '200': description: A paginated list of subscribers content: application/json: schema: type: object properties: subscribers: type: array items: $ref: '#/components/schemas/Subscriber' cursor: type: string post: tags: [Subscribers] summary: Create a subscriber operationId: createSubscriber requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SubscriberCreate' responses: '201': description: Subscriber created content: application/json: schema: $ref: '#/components/schemas/Subscriber' /api/v2/subscribers/{subscriber_id}: parameters: - $ref: '#/components/parameters/SubscriberId' get: tags: [Subscribers] summary: Get a subscriber operationId: getSubscriber responses: '200': description: The subscriber record content: application/json: schema: $ref: '#/components/schemas/Subscriber' patch: tags: [Subscribers] summary: Update a subscriber operationId: updateSubscriber requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Subscriber' responses: '200': description: Subscriber updated content: application/json: schema: $ref: '#/components/schemas/Subscriber' /api/v2/subscribers/{subscriber_id}/unsubscribe: parameters: - $ref: '#/components/parameters/SubscriberId' post: tags: [Subscribers] summary: Unsubscribe a subscriber operationId: unsubscribeSubscriber responses: '200': description: Subscriber unsubscribed /api/v2/events: post: tags: [Events] summary: Send a custom event description: Sends a custom event that can be used to trigger Postscript flows. operationId: createEvent requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Event' responses: '202': description: Event accepted /api/v2/webhooks: get: tags: [Webhooks] summary: List webhooks operationId: listWebhooks responses: '200': description: A list of webhook subscriptions content: application/json: schema: type: object properties: webhooks: type: array items: $ref: '#/components/schemas/Webhook' post: tags: [Webhooks] summary: Create a webhook operationId: createWebhook requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Webhook' responses: '201': description: Webhook created content: application/json: schema: $ref: '#/components/schemas/Webhook' /api/v2/webhooks/{webhook_id}: parameters: - name: webhook_id in: path required: true schema: type: string delete: tags: [Webhooks] summary: Delete a webhook operationId: deleteWebhook responses: '204': description: Webhook deleted components: securitySchemes: BearerAuth: type: http scheme: bearer description: | Postscript uses bearer token authentication. Generate API keys from the Postscript app under API Settings. parameters: SubscriberId: name: subscriber_id in: path required: true schema: type: string schemas: Subscriber: type: object properties: id: type: string phone_number: type: string email: type: string format: email first_name: type: string last_name: type: string opt_in_status: type: string created_at: type: string format: date-time properties: type: object additionalProperties: true SubscriberCreate: type: object required: - phone_number properties: phone_number: type: string email: type: string format: email first_name: type: string last_name: type: string properties: type: object additionalProperties: true Event: type: object required: - name properties: name: type: string description: Name of the custom event (for example browse_abandonment). phone_number: type: string email: type: string format: email properties: type: object additionalProperties: true Webhook: type: object required: - url - event_types properties: id: type: string url: type: string format: uri event_types: type: array items: type: string active: type: boolean