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

# Create webhook

> Registers an HTTPS endpoint that receives signed post.published, post.partially_published and post.failed events for API posts created after it was registered. The response is the only time the signing secret is returned. Up to 5 webhooks per account.



## OpenAPI

````yaml /openapi/public-api.yaml post /v1/webhooks
openapi: 3.1.0
info:
  title: PostOnce Public API
  version: 1.0.0-alpha
  description: Public API for PostOnce paid users
servers:
  - url: https://postonce.to/api/public
security:
  - bearerAuth: []
paths:
  /v1/webhooks:
    post:
      summary: Create webhook
      description: >-
        Registers an HTTPS endpoint that receives signed post.published,
        post.partially_published and post.failed events for API posts created
        after it was registered. The response is the only time the signing
        secret is returned. Up to 5 webhooks per account.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - url
              properties:
                url:
                  type: string
                  format: uri
                  description: Public HTTPS URL. Redirects are not followed.
                description:
                  type: string
                  maxLength: 200
      responses:
        '201':
          description: Webhook created. Store the secret now; it is not shown again.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    allOf:
                      - $ref: '#/components/schemas/Webhook'
                      - type: object
                        properties:
                          secret:
                            type: string
                            description: >-
                              Signing secret (whsec_...). Verify
                              PostOnce-Signature with it.
        '400':
          description: The URL is missing, not HTTPS, or not a public host.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing, invalid, revoked, or expired API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthErrorResponse'
        '409':
          description: The account already has 5 webhooks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Webhook:
      type: object
      properties:
        id:
          type: string
          format: uuid
        url:
          type: string
        description:
          type:
            - string
            - 'null'
        events:
          type: array
          items:
            type: string
            enum:
              - post.published
              - post.partially_published
              - post.failed
        created_at:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: workflow_limit_reached
            message:
              type: string
              example: You have reached the maximum number of workflows for your plan.
            hint:
              type: string
              description: Suggested action to resolve the error.
    AuthErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: invalid_api_key
            message:
              type: string
              example: Invalid API key.
            hint:
              type: string
              description: Suggested action to resolve the error.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Scoped API key issued in PostOnce Settings. OAuth authorization grants
        are not currently supported.
      x-scopes:
        accounts:read: List and read connected accounts.
        accounts:write: Connect and disconnect social accounts.
        media:read: Read uploaded media.
        media:write: Upload media.
        posts:read: Read posts and unpublished drafts.
        posts:write: Create, update, publish, cancel, retry, and delete posts and drafts.
        workflows:read: List and read crossposting workflows.
        workflows:write: Create, update, and delete crossposting workflows.

````

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