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

# Create webhook

> See the [Webhooks guide](/webhooks) for the exact payload shape Lojou sends, available events, and delivery behavior (no signature, no retries).



## OpenAPI

````yaml /openapi.yaml post /v1/webhooks
openapi: 3.1.0
info:
  title: Lojou API
  version: 1.0.0
  description: |
    Official reference for the Lojou `/v1` API — everything a developer needs
    to create products, process orders, manage plans, and receive webhooks
    from a Lojou store.
servers:
  - url: https://api.lojou.app
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Health
  - name: OAuth
  - name: User
  - name: Products
  - name: Plans
  - name: Orders
  - name: Customers
  - name: Files
  - name: Webhooks
  - name: Discounts
  - name: Affiliates
paths:
  /v1/webhooks:
    post:
      tags:
        - Webhooks
      summary: Create webhook
      description: >-
        See the [Webhooks guide](/webhooks) for the exact payload shape Lojou
        sends, available events, and delivery behavior (no signature, no
        retries).
      operationId: postV1Webhooks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookRequest'
      responses:
        '201':
          description: Webhook created
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                status: success
                message: Webhook created successfully.
                webhook:
                  id: 3
                  name: Novo pedido
                  url: https://minhaloja.example.com/webhooks/lojou
                  events:
                    - order_approved
                  product_details: null
                  event_success: null
                  event_error: null
                  reports_count: 0
                  created_at: '2026-08-31T16:25:00.000000Z'
                  updated_at: '2026-08-31T16:25:00.000000Z'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    CreateWebhookRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          example: https://minhaloja.example.com/webhooks/lojou
        name:
          type: string
          nullable: true
          example: Novo pedido
        events:
          description: |
            `order_refund` is offered as an option but is not currently fired by
            any real event — see the [Webhooks guide](/webhooks).
          oneOf:
            - type: array
              items:
                type: string
                enum:
                  - order_approved
                  - order_cancelled
                  - order_refund
            - type: object
              additionalProperties: true
            - type: string
          nullable: true
          example:
            - order_approved
            - order_cancelled
        product_details:
          oneOf:
            - type: object
              additionalProperties: true
            - type: array
              items:
                type: object
                additionalProperties: true
            - type: string
          nullable: true
        event_success:
          type: string
          nullable: true
        event_error:
          type: string
          nullable: true
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
          example: error
        message:
          type: string
      additionalProperties: true
    ValidationErrorResponse:
      allOf:
        - $ref: '#/components/schemas/ErrorResponse'
        - type: object
          properties:
            errors:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
  responses:
    UnauthorizedError:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Unauthorized user.
    ForbiddenError:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Permission denied for this endpoint.
            error_code: insufficient_scope
            required_scopes:
              - orders.read
            missing_scopes:
              - orders.read
            granted_scopes:
              - products.read
              - products.write
    ValidationError:
      description: Validation failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
          example:
            status: error
            message: Validation failed.
            errors:
              amount:
                - The amount field is required.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        Send an API key or an OAuth access token in the `Authorization` header
        as a Bearer token. See [Authentication](/authentication) for details.

````