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

# Subscribe to webhooks

> Enrolls the OAuth app for all books the authenticated user can currently access. Repeated calls return the same subscription. No request body is required. Enrollment is independent of access-token expiration.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/webhook_subscription
openapi: 3.0.1
info:
  title: Slant Public API V1
  version: v1
  description: Public API for creating and managing resources in Slant
  contact:
    name: Slant API Support
    email: api@slant.com
servers:
  - url: https://api.slant.app
security:
  - bearer: []
paths:
  /v1/webhook_subscription:
    post:
      tags:
        - Webhooks
      summary: Subscribe to webhooks
      description: >-
        Enrolls the OAuth app for all books the authenticated user can currently
        access. Repeated calls return the same subscription. No request body is
        required. Enrollment is independent of access-token expiration.
      responses:
        '201':
          description: subscribed
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - user_id
                  - created_at
                properties:
                  id:
                    type: string
                  user_id:
                    type: string
                  created_at:
                    type: string
                    format: date-time
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          description: missing OAuth token
        '403':
          $ref: '#/components/responses/Forbidden'
      security:
        - bearer: []
components:
  responses:
    BadRequest:
      description: Bad Request - invalid JSON
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            invalid_json:
              value:
                error: invalid_json
                detail: Request body must be valid JSON
    Forbidden:
      description: Forbidden - client not found or user not linked
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            client_not_found:
              value:
                error: client_not_found
                detail: Invalid or inactive client
            user_not_linked:
              value:
                error: user_not_linked
                detail: No matching user for provided token
            principal_book_missing:
              value:
                error: principal_book_missing
                detail: User must have a principal book
            not_authorized:
              value:
                error: not_authorized
                detail: You are not permitted to perform this action
  schemas:
    Error:
      type: object
      required:
        - error
        - detail
      properties:
        error:
          type: string
          description: Error code
        detail:
          type: string
          description: Human-readable error description
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: OAuth
      description: OAuth 2.0 Bearer Token from Clerk authentication

````

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