openapi: 3.1.0 info: title: Buttondown Exports 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: Exports paths: /exports: post: operationId: create_export summary: Create Export parameters: [] responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Export' links: retrieve_export: operationId: retrieve_export parameters: path.id: $response.body#/id '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/ErrorMessage_CreateExportErrorCode_' '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' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorMessage' '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 data export tags: - Exports requestBody: content: application/json: schema: $ref: '#/components/schemas/ExportInput' required: true security: - ApiKeyAuth: [] get: operationId: list_exports summary: List Exports 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/ExportPage' '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/ErrorMessage' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorMessage' '409': description: Conflict '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorMessage' '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 exports tags: - Exports security: - ApiKeyAuth: [] /exports/{id}: get: operationId: retrieve_export summary: Retrieve Export parameters: - in: path name: id schema: title: Id type: string required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Export' links: {} '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 '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorMessage' '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 export by its ID tags: - Exports security: - ApiKeyAuth: [] components: schemas: CreateExportErrorCode: enum: - collection_empty_invalid - columns_empty_invalid - columns_invalid title: CreateExportErrorCode type: string description: An enumeration. 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 ErrorMessage_CreateExportErrorCode_: properties: code: allOf: - $ref: '#/components/schemas/CreateExportErrorCode' description: The error code. 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[CreateExportErrorCode] type: object Export: description: 'Some software applications may want programmatic access to their newsletter exports. This assists with a few niche use cases, such as regular backups or data ingestion (into a data warehouse), or post-publishing processes that hinge on email events. In general, you probably won''t _need_ to use this endpoint unless you _absolutely_ need to use this endpoint. To browse the contents of a given export collection, refer to the [Data exports](https://docs.buttondown.com/data-exports-subscriber) section of the documentation.' 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 collections: description: The [collections](https://docs.buttondown.com/api-exports-collections) of objects to export. items: $ref: '#/components/schemas/ExportCollection' title: Collections type: array example: - subscribers parameters: anyOf: - additionalProperties: true type: object - type: 'null' description: Parameters to pass to the exporter. These are specific to the collection and format, and constrain the export. title: Parameters example: status: active format: allOf: - $ref: '#/components/schemas/ExportFormat' default: csv description: The [format](https://docs.buttondown.com/api-exports-format) of the export files. example: csv columns: anyOf: - items: type: string type: array - type: 'null' description: If provided, the export will only include these columns. title: Columns example: - id - email url: anyOf: - type: string - type: 'null' description: The URL of the export file. This is only available after the export has completed. title: Url completion_date: anyOf: - format: date-time type: string - type: 'null' description: The date and time the export completed. title: Completion Date status: $ref: '#/components/schemas/ExportStatus' description: The status of the export. example: not_started required: - id - creation_date - collections - status title: Export type: object ExportCollection: description: A group of data that can be exported in an export. enum: - subscribers - emails - events - referrals - surveys - comments - requests - mentions - conversations - images - stripe_subscriptions - stripe_products - stripe_customers - stripe_prices - stripe_charges title: Collection type: string ExportFormat: enum: - csv - json title: Format type: string description: An enumeration. ExportInput: additionalProperties: false properties: collections: description: The [collections](https://docs.buttondown.com/api-exports-collections) of objects to export. items: $ref: '#/components/schemas/ExportCollection' title: Collections type: array example: - subscribers parameters: anyOf: - additionalProperties: true type: object - type: 'null' description: Parameters to pass to the exporter. These are specific to the collection and format, and constrain the export. title: Parameters example: status: active format: allOf: - $ref: '#/components/schemas/ExportFormat' default: csv description: The [format](https://docs.buttondown.com/api-exports-format) of the export files. example: csv columns: anyOf: - items: type: string type: array - type: 'null' description: If provided, the export will only include these columns. title: Columns example: - id - email required: - collections title: ExportInput type: object ExportPage: properties: results: description: The list of results for this page. items: $ref: '#/components/schemas/Export' 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[Export] type: object ExportStatus: type: string enum: - error - in_progress - not_started - ready title: ExportStatus description: 'Represents the status of an export. No action is required to move from one state or another; Buttondown internally handles the transitions, and exposing the status is for observability purposes only.' 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 ' in the Authorization header.