Buttondown Books API

The Books API from Buttondown — 5 operation(s) covering the Bookshop.org book catalog embedded in newsletters.

OpenAPI Specification

buttondown-books-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Buttondown Books API
  version: 1.0.0
  description: The Buttondown API lets you manage newsletters, subscribers, emails, and more. See [the documentation](https://docs.buttondown.com/api-introduction)
    for guides and examples.
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
- url: https://api.buttondown.com/v1
security:
- ApiKeyAuth: []
tags:
- name: Books
paths:
  /books:
    post:
      operationId: create_book
      summary: Create Book
      parameters: []
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Book'
          links:
            retrieve_book:
              operationId: retrieve_book
              parameters:
                path.id: $response.body#/id
            update_book:
              operationId: update_book
              parameters:
                path.id: $response.body#/id
            delete_book:
              operationId: delete_book
              parameters:
                path.id: $response.body#/id
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Conflict
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorMessage'
        '429':
          description: Too Many Requests
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
            X-RateLimit-Limit:
              description: Requests permitted per minute.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests remaining in the current window.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: Unix timestamp at which the window resets.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: Create a new book
      tags:
      - Books
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BookInput'
        required: true
      security:
      - ApiKeyAuth: []
    get:
      operationId: list_books
      summary: List Books
      parameters:
      - in: query
        name: page
        required: false
        description: The page number of the paginated response.
        schema:
          type: integer
          title: Page
          description: The page number of the paginated response.
          default: 1
          example: 1
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BookPage'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Conflict
        '429':
          description: Too Many Requests
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
            X-RateLimit-Limit:
              description: Requests permitted per minute.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests remaining in the current window.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: Unix timestamp at which the window resets.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: List all books for the authenticated newsletter
      tags:
      - Books
      security:
      - ApiKeyAuth: []
  /books/{id}:
    get:
      operationId: retrieve_book
      summary: Retrieve Book
      parameters:
      - in: path
        name: id
        schema:
          title: Id
          type: string
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Book'
          links:
            update_book:
              operationId: update_book
              parameters:
                path.id: $response.body#/id
            delete_book:
              operationId: delete_book
              parameters:
                path.id: $response.body#/id
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Conflict
        '429':
          description: Too Many Requests
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
            X-RateLimit-Limit:
              description: Requests permitted per minute.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests remaining in the current window.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: Unix timestamp at which the window resets.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: Retrieve a specific book by its ID
      tags:
      - Books
      security:
      - ApiKeyAuth: []
    patch:
      operationId: update_book
      summary: Update Book
      parameters:
      - in: path
        name: id
        schema:
          title: Id
          type: string
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Book'
          links:
            retrieve_book:
              operationId: retrieve_book
              parameters:
                path.id: $response.body#/id
            delete_book:
              operationId: delete_book
              parameters:
                path.id: $response.body#/id
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Conflict
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorMessage'
        '429':
          description: Too Many Requests
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
            X-RateLimit-Limit:
              description: Requests permitted per minute.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests remaining in the current window.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: Unix timestamp at which the window resets.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: Update a book's properties
      tags:
      - Books
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BookUpdateInput'
        required: true
      security:
      - ApiKeyAuth: []
    delete:
      operationId: delete_book
      summary: Delete Book
      parameters:
      - in: path
        name: id
        schema:
          title: Id
          type: string
        required: true
      responses:
        '204':
          description: No Content
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Conflict
        '429':
          description: Too Many Requests
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
            X-RateLimit-Limit:
              description: Requests permitted per minute.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests remaining in the current window.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: Unix timestamp at which the window resets.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: Delete a book
      tags:
      - Books
      security:
      - ApiKeyAuth: []
components:
  schemas:
    Book:
      properties:
        id:
          description: A unique TypeID associated with the object.
          title: Id
          type: string
        creation_date:
          description: The date and time at which the object was first created.
          format: date-time
          title: Creation Date
          type: string
        title:
          description: The title of the book.
          maxLength: 500
          title: Title
          type: string
        url:
          default: ''
          description: The URL where the book can be purchased or viewed.
          maxLength: 2000
          title: Url
          type: string
        image_url:
          default: ''
          description: The URL of the book's cover image.
          maxLength: 2000
          title: Image Url
          type: string
        description:
          default: ''
          description: A description of the book.
          title: Description
          type: string
        year:
          anyOf:
          - maximum: 2147483647
            minimum: -2147483648
            type: integer
          - type: 'null'
          description: The year the book was published.
          title: Year
        isbn:
          default: ''
          description: The ISBN of the book.
          maxLength: 20
          title: Isbn
          type: string
        shared:
          default: true
          description: Whether the book is displayed publicly on the archive.
          title: Shared
          type: boolean
      required:
      - id
      - creation_date
      - title
      title: Book
      type: object
    BookInput:
      additionalProperties: false
      properties:
        title:
          description: The title of the book.
          maxLength: 500
          minLength: 1
          title: Title
          type: string
        url:
          default: ''
          description: The URL where the book can be purchased or viewed.
          maxLength: 2000
          title: Url
          type: string
        image_url:
          default: ''
          description: The URL of the book's cover image.
          maxLength: 2000
          title: Image Url
          type: string
        description:
          default: ''
          description: A description of the book.
          title: Description
          type: string
        year:
          anyOf:
          - maximum: 2147483647
            minimum: -2147483648
            type: integer
          - type: 'null'
          description: The year the book was published.
          title: Year
        isbn:
          default: ''
          description: The ISBN of the book.
          maxLength: 20
          title: Isbn
          type: string
        shared:
          default: true
          description: Whether the book is displayed publicly on the archive.
          title: Shared
          type: boolean
      required:
      - title
      title: BookInput
      type: object
    BookPage:
      properties:
        results:
          description: The list of results for this page.
          items:
            $ref: '#/components/schemas/Book'
          title: Results
          type: array
        next:
          anyOf:
          - type: string
          - type: 'null'
          description: The URL to the next page of results, if any.
          title: Next
        previous:
          anyOf:
          - type: string
          - type: 'null'
          description: The URL to the previous page of results, if any.
          title: Previous
        count:
          description: The total number of results across all pages.
          title: Count
          type: integer
      required:
      - results
      - count
      title: Page[Book]
      type: object
    BookUpdateInput:
      additionalProperties: false
      properties:
        title:
          anyOf:
          - maxLength: 500
            type: string
          - type: 'null'
          description: The title of the book.
          title: Title
        url:
          anyOf:
          - maxLength: 2000
            type: string
          - type: 'null'
          description: The URL where the book can be purchased or viewed.
          title: Url
        image_url:
          anyOf:
          - maxLength: 2000
            type: string
          - type: 'null'
          description: The URL of the book's cover image.
          title: Image Url
        description:
          anyOf:
          - type: string
          - type: 'null'
          description: A description of the book.
          title: Description
        year:
          anyOf:
          - maximum: 2147483647
            minimum: -2147483648
            type: integer
          - type: 'null'
          description: The year the book was published.
          title: Year
        isbn:
          anyOf:
          - maxLength: 20
            type: string
          - type: 'null'
          description: The ISBN of the book.
          title: Isbn
        shared:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Whether the book is displayed publicly on the archive.
          title: Shared
      title: BookUpdateInput
      type: object
    ErrorMessage:
      properties:
        code:
          description: The error code.
          title: Code
          type: string
        detail:
          description: A human-readable description of the error.
          title: Detail
          type: string
        metadata:
          additionalProperties:
            type: string
          default: {}
          description: Additional context about the error. When present, a `documentation_url` key links to docs explaining
            how to resolve it.
          title: Metadata
          type: object
      required:
      - detail
      title: ErrorMessage
      type: object
    ValidationErrorDetail:
      properties:
        type:
          description: The type of validation error.
          title: Type
          type: string
        loc:
          description: The location of the error in the request.
          items:
            anyOf:
            - type: string
            - type: integer
          title: Loc
          type: array
        msg:
          description: A human-readable error message.
          title: Msg
          type: string
      required:
      - type
      - loc
      - msg
      title: ValidationErrorDetail
      type: object
    ValidationErrorMessage:
      properties:
        detail:
          description: A list of validation errors.
          items:
            $ref: '#/components/schemas/ValidationErrorDetail'
          title: Detail
          type: array
      required:
      - detail
      title: ValidationErrorMessage
      type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: API key passed as 'Token <your-api-key>' in the Authorization header.