Ocrolus Oauth API

The Oauth API from Ocrolus — 1 operation(s) for oauth.

OpenAPI Specification

ocrolus-oauth-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Account Level Webhooks Book Commands Oauth API
  version: 1.0.0
servers:
- url: https://api.ocrolus.com
security:
- oauth: []
tags:
- name: Oauth
paths:
  /oauth/token:
    post:
      summary: Grant authentication token
      operationId: grant-authentication-token
      description: "Retrieve a JWT-compliant access token for use with all other endpoints.\n\n---\n\n\n\n> \U0001F4D8\n> All tokens currently expire after 24 hours (86,400 seconds), but we suggest refreshing tokens every 12 hours (43,200 seconds).\n\nHere's an example of using the returned token in an API call:\n```cURL\ncurl \\\n  --url \"https://api.ocrolus.com/v1/books\" \\\n  --oauth2-bearer \"eyJhbGciOiJ...2hUye_4CpIvQ\"\n\n```\nSee our guide on [using API credentials](doc:using-api-credentials) for more details.\n\nThis endpoint is OAuth 2.0-compliant. A successful response from this endpoint adheres to the structure given in [RFC 6749, section 5.1](https://datatracker.ietf.org/doc/html/rfc6749#section-5.1), while a failed response adheres to the structure given in [section 5.2](https://datatracker.ietf.org/doc/html/rfc6749#section-5.2). As a consequence, you can use this endpoint in OAuth 2.0 clients and libraries without needing to explicitly call it in your own code.\n"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
              - grant_type
              - client_id
              - client_secret
              properties:
                grant_type:
                  type: string
                  description: The OAuth 2.0 grant type for the returned token. Must have a value of `client_credentials`, as we don't offer other grant types at this time.
                  enum:
                  - client_credentials
                  default: client_credentials
                audience:
                  type: string
                  description: The domain in which the token will be used. We currently only support the value of `https://api.ocrolus.com/` (including the trailing /).
                  enum:
                  - https://api.ocrolus.com/
                client_id:
                  type: string
                  description: The client ID that was generated from the Ocrolus Dashboard.
                client_secret:
                  type: string
                  description: The client secret associated with the client ID that was generated from the Ocrolus Dashboard.
              example:
                grant_type: client_credentials
                audience: https://api.ocrolus.com/
                client_id: CLIENT_ID_EXAMPLE
                client_secret: CLIENT_SECRET_EXAMPLE
      x-readme:
        samples-languages:
        - curl
        - python
        explorer-enabled: false
      responses:
        '200':
          description: Success
          content:
            application/json:
              examples:
                Success:
                  value:
                    access_token: eyJz93a...k4laUWw
                    token_type: Bearer
                    expires_in: 86400
              schema:
                title: Success
                type: object
                properties:
                  access_token:
                    type: string
                    description: A JWT-compliant access token for use with all other endpoints.
                    example: eyJz93a...k4laUWw
                  token_type:
                    type: string
                    description: The type of access token received.
                    example: Bearer
                  expires_in:
                    type: integer
                    description: The amount of time before the provided access token becomes invalid.
        '400':
          description: Unauthorized
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    error: access_denied
                    error_description: Unauthorized
              schema:
                title: Unauthorized
                type: object
                properties:
                  error:
                    type: string
                    description: The received error from the request.
                    example: access_denied
                  error_description:
                    type: string
                    description: An explanation of the stated error.
                    example: Unauthorized
      tags:
      - Oauth
components:
  securitySchemes:
    oauth:
      type: oauth2
      description: 'OAuth 2.0 support via client credentials flow. See [here](doc:using-api-credentials) for usage information.

        '
      flows:
        clientCredentials:
          tokenUrl: https://auth.ocrolus.com/oauth/token
          scopes: {}