openapi: 3.2.0 info: title: Reference Newsletter Lists API version: 1.0.0 servers: - url: https://api.beehiiv.com/v2 description: Default tags: - name: Newsletter Lists paths: /publications/{publicationId}/newsletter_lists: get: operationId: index summary: 'List newsletter lists OAuth Scope: newsletter_lists:read' description: List all newsletter lists for a publication. tags: - Newsletter Lists parameters: - name: publicationId in: path description: The prefixed ID of the publication object required: true schema: $ref: '#/components/schemas/type_ids_PublicationId' - name: limit in: query description: A limit on the number of objects to be returned. The limit can range between 1 and 100, and the default is 10. required: false schema: type: integer - name: page in: query description: 'Pagination returns the results in pages. Each page contains the number of results specified by the `limit` (default: 10).
If not specified, results 1-10 from page 1 will be returned.' required: false schema: type: integer - name: direction in: query description: The direction that the results are sorted in. Defaults to asc
`asc` - Ascending, sorts from smallest to largest.
`desc` - Descending, sorts from largest to smallest. required: false schema: $ref: '#/components/schemas/type__RequestDirection' - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/type_newsletterLists_NewsletterListIndexResponse' '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/type__Error' '401': description: Unauthorized. The API key or OAuth access token is missing, invalid, or expired. content: application/json: schema: $ref: '#/components/schemas/type__Error' '404': description: Resource Not Found content: application/json: schema: $ref: '#/components/schemas/type__Error' '429': description: Rate Limit Exceeded content: application/json: schema: $ref: '#/components/schemas/type__Error' '500': description: Internal Server Error content: application/json: schema: $ref: '#/components/schemas/type__Error' post: operationId: create summary: 'Create newsletter list OAuth Scope: newsletter_lists:write' description: Create a new newsletter list for a publication. The list will be created with an active status. The slug will be auto-generated from the name if not provided. tags: - Newsletter Lists parameters: - name: publicationId in: path description: The prefixed ID of the publication object required: true schema: $ref: '#/components/schemas/type_ids_PublicationId' - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/type_newsletterLists_NewsletterListResponse' '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/type__Error' '401': description: Unauthorized. The API key or OAuth access token is missing, invalid, or expired. content: application/json: schema: $ref: '#/components/schemas/type__Error' '404': description: Resource Not Found content: application/json: schema: $ref: '#/components/schemas/type__Error' '422': description: Unprocessable Entity content: application/json: schema: $ref: '#/components/schemas/type__Error' '429': description: Rate Limit Exceeded content: application/json: schema: $ref: '#/components/schemas/type__Error' '500': description: Internal Server Error content: application/json: schema: $ref: '#/components/schemas/type__Error' requestBody: content: application/json: schema: type: object properties: name: type: string description: The name of the newsletter list. description: type: string description: A description of the newsletter list. slug: type: string description: A unique slug for the newsletter list. Auto-generated from the name if not provided. auto_subscribe: type: boolean description: Whether new subscribers are automatically subscribed to this list. required: - name /publications/{publicationId}/newsletter_lists/{newsletterListId}: get: operationId: show summary: 'Get newsletter list OAuth Scope: newsletter_lists:read' description: Retrieve a single newsletter list belonging to a specific publication. tags: - Newsletter Lists parameters: - name: publicationId in: path description: The prefixed ID of the publication object required: true schema: $ref: '#/components/schemas/type_ids_PublicationId' - name: newsletterListId in: path description: The prefixed ID of the newsletter list object required: true schema: $ref: '#/components/schemas/type_ids_NewsletterListId' - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/type_newsletterLists_NewsletterListResponse' '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/type__Error' '401': description: Unauthorized. The API key or OAuth access token is missing, invalid, or expired. content: application/json: schema: $ref: '#/components/schemas/type__Error' '404': description: Resource Not Found content: application/json: schema: $ref: '#/components/schemas/type__Error' '429': description: Rate Limit Exceeded content: application/json: schema: $ref: '#/components/schemas/type__Error' '500': description: Internal Server Error content: application/json: schema: $ref: '#/components/schemas/type__Error' patch: operationId: update summary: 'Update newsletter list OAuth Scope: newsletter_lists:write' description: Update a newsletter list belonging to a specific publication. tags: - Newsletter Lists parameters: - name: publicationId in: path description: The prefixed ID of the publication object required: true schema: $ref: '#/components/schemas/type_ids_PublicationId' - name: newsletterListId in: path description: The prefixed ID of the newsletter list object required: true schema: $ref: '#/components/schemas/type_ids_NewsletterListId' - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/type_newsletterLists_NewsletterListResponse' '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/type__Error' '401': description: Unauthorized. The API key or OAuth access token is missing, invalid, or expired. content: application/json: schema: $ref: '#/components/schemas/type__Error' '404': description: Resource Not Found content: application/json: schema: $ref: '#/components/schemas/type__Error' '422': description: Unprocessable Entity content: application/json: schema: $ref: '#/components/schemas/type__Error' '429': description: Rate Limit Exceeded content: application/json: schema: $ref: '#/components/schemas/type__Error' '500': description: Internal Server Error content: application/json: schema: $ref: '#/components/schemas/type__Error' requestBody: content: application/json: schema: type: object properties: name: type: string description: The name of the newsletter list. description: type: string description: A description of the newsletter list. slug: type: string description: A unique slug for the newsletter list. auto_subscribe: type: boolean description: Whether new subscribers are automatically subscribed to this list. status: $ref: '#/components/schemas/type_newsletterLists_NewsletterListWritableStatus' description: The status of the newsletter list. Valid values are `active` and `archived`. Setting `draft` is not permitted. delete: operationId: delete summary: 'Delete newsletter list OAuth Scope: newsletter_lists:write' description: Delete a newsletter list belonging to a specific publication. tags: - Newsletter Lists parameters: - name: publicationId in: path description: The prefixed ID of the publication object required: true schema: $ref: '#/components/schemas/type_ids_PublicationId' - name: newsletterListId in: path description: The prefixed ID of the newsletter list object required: true schema: $ref: '#/components/schemas/type_ids_NewsletterListId' - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '200': description: Successful response '401': description: Unauthorized. The API key or OAuth access token is missing, invalid, or expired. content: application/json: schema: $ref: '#/components/schemas/type__Error' '404': description: Resource Not Found content: application/json: schema: $ref: '#/components/schemas/type__Error' '429': description: Rate Limit Exceeded content: application/json: schema: $ref: '#/components/schemas/type__Error' '500': description: Internal Server Error content: application/json: schema: $ref: '#/components/schemas/type__Error' components: schemas: type_newsletterLists_NewsletterListStatus: type: string enum: - draft - active - archived description: The status of the newsletter list. title: NewsletterListStatus type_ids_PublicationId: type: string description: The prefixed ID of the publication. title: PublicationId type_newsletterLists_NewsletterListInfo: type: object properties: id: $ref: '#/components/schemas/type_ids_NewsletterListId' description: The prefixed ID of the newsletter list. name: type: string description: The name of the newsletter list. slug: type: string description: The URL-friendly slug of the newsletter list. description: type: string description: A description of the newsletter list. status: $ref: '#/components/schemas/type_newsletterLists_NewsletterListStatus' description: The status of the newsletter list. auto_subscribe: type: boolean description: Whether new subscribers are automatically subscribed to this list. subscriber_count: type: integer description: The number of active subscribers on this list. created_at: type: integer description: The time the newsletter list was created. Measured in seconds since the Unix epoch. updated_at: type: integer description: The time the newsletter list was last updated. Measured in seconds since the Unix epoch. required: - id - name - slug - status - auto_subscribe - subscriber_count - created_at - updated_at title: NewsletterListInfo type_newsletterLists_NewsletterListWritableStatus: type: string enum: - active - archived description: Valid status values when updating a newsletter list. draft is not permitted. title: NewsletterListWritableStatus type__Error: type: object properties: status: type: integer statusText: type: string errors: type: array items: $ref: '#/components/schemas/type__ErrorDetail' required: - status - statusText - errors description: The top level error response. title: Error type_ids_NewsletterListId: type: string description: The prefixed ID of the newsletter list. title: NewsletterListId type__RequestDirection: type: string enum: - asc - desc default: asc description: The direction of the request. Defaults to `asc`. title: RequestDirection type_newsletterLists_NewsletterListIndexResponse: type: object properties: data: type: array items: $ref: '#/components/schemas/type_newsletterLists_NewsletterListInfo' limit: type: integer description: The limit placed on the results. If no limit was specified in the request, this defaults to 10. page: type: integer default: 1 description: The page number the results are from. If no page was specified in the request, this defaults to page 1. total_results: type: integer description: The total number of results from all pages. total_pages: type: integer description: The total number of pages. required: - data - limit - page - total_results - total_pages title: NewsletterListIndexResponse type_newsletterLists_NewsletterListResponse: type: object properties: data: $ref: '#/components/schemas/type_newsletterLists_NewsletterListInfo' required: - data title: NewsletterListResponse type__ErrorDetail: type: object properties: message: type: string code: type: string required: - message - code title: ErrorDetail securitySchemes: BearerAuthScheme: type: http scheme: bearer