openapi: 3.2.0 info: title: Reference Custom Fields API version: 1.0.0 servers: - url: https://api.beehiiv.com/v2 description: Default tags: - name: Custom Fields paths: /publications/{publicationId}/custom_fields: post: operationId: create summary: 'Create custom field OAuth Scope: custom_fields:write' description: Create a custom field on a publication, for use in subscriptions. tags: - Custom Fields 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: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/type_customFields_CustomFieldResponse' '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' requestBody: content: application/json: schema: type: object properties: kind: $ref: '#/components/schemas/type__CustomFieldType' display: type: string required: - kind - display get: operationId: index summary: 'List custom fields OAuth Scope: custom_fields:read' description: List all custom fields on a publication. tags: - Custom Fields 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: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/type_customFields_CustomFieldIndexResponse' '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' /publications/{publicationId}/custom_fields/{id}: get: operationId: show summary: 'Get custom field OAuth Scope: custom_fields:read' description: View a specific custom field on a publication. tags: - Custom Fields parameters: - name: publicationId in: path description: The prefixed ID of the publication object required: true schema: $ref: '#/components/schemas/type_ids_PublicationId' - name: id in: path description: The ID of the Custom Fields object required: true schema: type: string - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/type_customFields_CustomFieldResponse' '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' put: operationId: put summary: 'Update custom field OAuth Scope: custom_fields:write' description: Update a custom field on a publication. tags: - Custom Fields parameters: - name: publicationId in: path description: The prefixed ID of the publication object required: true schema: $ref: '#/components/schemas/type_ids_PublicationId' - name: id in: path description: The ID of the Custom Fields object required: true schema: type: string - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/type_customFields_CustomFieldResponse' '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' requestBody: content: application/json: schema: type: object properties: display: type: string patch: operationId: patch summary: 'Update custom field OAuth Scope: custom_fields:write' description: Update a custom field on a publication. tags: - Custom Fields parameters: - name: publicationId in: path description: The prefixed ID of the publication object required: true schema: $ref: '#/components/schemas/type_ids_PublicationId' - name: id in: path description: The ID of the Custom Fields object required: true schema: type: string - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/type_customFields_CustomFieldsPatchResponse' '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' requestBody: content: application/json: schema: type: object properties: display: type: string delete: operationId: delete summary: 'Delete custom field OAuth Scope: custom_fields:write' description: Delete a custom field from a publication. tags: - Custom Fields parameters: - name: publicationId in: path description: The prefixed ID of the publication object required: true schema: $ref: '#/components/schemas/type_ids_PublicationId' - name: id in: path description: The ID of the Custom Fields object required: true schema: type: string - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '204': description: No Content content: application/json: schema: $ref: '#/components/schemas/type_customFields_CustomFieldsDeleteResponse' '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' components: schemas: type_customFields_CustomFieldInfo: type: object properties: id: type: string kind: $ref: '#/components/schemas/type__CustomFieldType' display: type: string created: type: integer options: type: array items: type: string description: Array of option values. Only included when kind is "list". title: CustomFieldInfo type_customFields_CustomFieldsPatchResponse: type: object properties: data: $ref: '#/components/schemas/type_customFields_CustomFieldInfo' title: CustomFieldsPatchResponse type__CustomFieldType: type: string enum: - string - integer - boolean - date - datetime - list - double description: The type of value being stored in the custom field. title: CustomFieldType type_customFields_CustomFieldsDeleteResponse: type: object properties: message: type: string title: CustomFieldsDeleteResponse type_ids_PublicationId: type: string description: The prefixed ID of the publication. title: PublicationId 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__ErrorDetail: type: object properties: message: type: string code: type: string required: - message - code title: ErrorDetail type_customFields_CustomFieldResponse: type: object properties: data: $ref: '#/components/schemas/type_customFields_CustomFieldInfo' title: CustomFieldResponse type_customFields_CustomFieldIndexResponse: type: object properties: data: type: array items: $ref: '#/components/schemas/type_customFields_CustomFieldInfo' 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. title: CustomFieldIndexResponse securitySchemes: BearerAuthScheme: type: http scheme: bearer