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

# Create a webhook

> Register a public https:// webhook endpoint and generate a one-time HMAC signing secret.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/webhooks
openapi: 3.1.0
info:
  title: Gainflow API
  version: 1.1.0
  description: >
    Hard-to-get web data delivered to builders and AI agents. All public REST
    endpoints use snake_case JSON, RFC 9457 application/problem+json errors,
    opaque cursor pagination, and IETF RateLimit headers. Remote MCP server
    endpoint: https://mcp.gainflow.ai/mcp (OAuth 2.1 via WorkOS AuthKit or
    Bearer gf_live_*).
servers:
  - url: https://api.gainflow.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Scraping
    description: Fetch pages and PDFs, and discover URLs on a site.
  - name: Monitors
    description: Scheduled website change monitoring and diff history.
  - name: Webhooks
    description: Signed HMAC-SHA256 outbound webhook endpoints and delivery logs.
  - name: Batches
    description: Asynchronous bulk URL scraping jobs.
  - name: Crawls
    description: Asynchronous multi-page website crawls.
  - name: Account
    description: Credit balance, plan and the credit ledger.
  - name: API keys
    description: Create, list and revoke gf_live_* keys. Needs a signed-in OAuth session.
  - name: Billing
    description: Stripe Checkout and Customer Portal. Needs a signed-in OAuth session.
paths:
  /v1/webhooks:
    post:
      tags:
        - Webhooks
      summary: Create a webhook
      description: >-
        Register a public https:// webhook endpoint and generate a one-time HMAC
        signing secret.
      operationId: createWebhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookRequest'
      responses:
        '201':
          description: Created webhook with one-time whsec_* signing secret
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedWebhook'
        '400':
          $ref: '#/components/responses/ProblemResponse'
        '401':
          $ref: '#/components/responses/ProblemResponse'
        '429':
          $ref: '#/components/responses/ProblemResponse'
components:
  schemas:
    CreateWebhookRequest:
      type: object
      additionalProperties: false
      required:
        - url
        - events
      properties:
        url:
          type: string
          format: uri
          maxLength: 1024
          description: >-
            Public https:// endpoint (private/localhost/internal hosts are
            rejected).
        events:
          type: array
          minItems: 1
          maxItems: 10
          items:
            $ref: '#/components/schemas/WebhookEventType'
    CreatedWebhook:
      allOf:
        - $ref: '#/components/schemas/WebhookSummary'
        - type: object
          required:
            - secret
          properties:
            secret:
              type: string
              description: >-
                One-time whsec_* HMAC-SHA256 signing secret
                (X-Gainflow-Signature header).
    WebhookEventType:
      type: string
      enum:
        - monitor.changed
        - batch.completed
        - crawl.completed
    WebhookSummary:
      type: object
      required:
        - id
        - url
        - events
        - enabled
        - created_at
      properties:
        id:
          type: string
          format: uuid
        url:
          type: string
          format: uri
        events:
          type: array
          items:
            $ref: '#/components/schemas/WebhookEventType'
        enabled:
          type: boolean
        created_at:
          type: string
          format: date-time
    ProblemDetails:
      type: object
      required:
        - type
        - title
        - status
        - code
        - request_id
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        code:
          type: string
          enum:
            - UNAUTHORIZED
            - FORBIDDEN
            - INSUFFICIENT_CREDITS
            - RATE_LIMITED
            - VALIDATION_ERROR
            - NOT_FOUND
            - CONFLICT
            - UPSTREAM_FAILED
            - INTERNAL_ERROR
        request_id:
          type: string
  responses:
    ProblemResponse:
      description: RFC 9457 Problem Details error
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Either a Gainflow API key (gf_live_*) or a WorkOS AuthKit OAuth 2.1 JWT.

````

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