openapi: 3.1.0
info:
title: API Reference subpackage_advertisement_opportunities subpackage_tiers API
version: 1.0.0
servers:
- url: https://api.beehiiv.com/v2
tags:
- name: subpackage_tiers
paths:
/publications/{publicationId}/tiers:
post:
operationId: create
summary: 'Create a tier OAuth Scope: tiers:write'
description: Create a new tier for a publication.
tags:
- subpackage_tiers
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: Created
content:
application/json:
schema:
$ref: '#/components/schemas/type_tiers:TierResponse'
'400':
description: Bad Request
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:
name:
type: string
description:
type: string
prices_attributes:
type: array
items:
$ref: '#/components/schemas/type_tiers:TierPricesAttributesItem'
required:
- name
get:
operationId: index
summary: 'List tiers OAuth Scope: tiers:read'
description: Retrieve all tiers belonging to a specific publication
tags:
- subpackage_tiers
parameters:
- name: publicationId
in: path
description: The prefixed ID of the publication object
required: true
schema:
$ref: '#/components/schemas/type_ids:PublicationId'
- name: expand[]
in: query
description: Optional list of expandable objects.
`stats` - Returns statistics about the tier(s).
`prices` - Returns prices for the tier(s).
required: false
schema:
type: string
- 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_tiers:IndexTiersResponse'
'400':
description: Bad Request
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}/tiers/{tierId}:
get:
operationId: show
summary: 'Get tier OAuth Scope: tiers:read'
description: Retrieve a single tier belonging to a specific publication
tags:
- subpackage_tiers
parameters:
- name: publicationId
in: path
description: The prefixed ID of the publication object
required: true
schema:
$ref: '#/components/schemas/type_ids:PublicationId'
- name: tierId
in: path
description: The prefixed ID of the tier object
required: true
schema:
$ref: '#/components/schemas/type_ids:TierId'
- name: expand[]
in: query
description: Optional list of expandable objects.
`stats` - Returns statistics about the tier(s).
`prices` - Returns prices for the tier(s).
required: false
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_tiers:TierResponse'
'400':
description: Bad Request
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 a tier OAuth Scope: tiers:write'
description: Update an existing tier belonging to a specific publication
tags:
- subpackage_tiers
parameters:
- name: publicationId
in: path
description: The prefixed ID of the publication object
required: true
schema:
$ref: '#/components/schemas/type_ids:PublicationId'
- name: tierId
in: path
description: The prefixed ID of the tier object
required: true
schema:
$ref: '#/components/schemas/type_ids:TierId'
- name: Authorization
in: header
description: Bearer authentication
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/type_tiers:TierResponse'
'400':
description: Bad Request
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:
name:
type: string
description:
type: string
prices_attributes:
type: array
items:
$ref: '#/components/schemas/type_tiers:UpdateTierPriceRequest'
patch:
operationId: patch
summary: 'Update a tier OAuth Scope: tiers:write'
description: Update an existing tier belonging to a specific publication
tags:
- subpackage_tiers
parameters:
- name: publicationId
in: path
description: The prefixed ID of the publication object
required: true
schema:
$ref: '#/components/schemas/type_ids:PublicationId'
- name: tierId
in: path
description: The prefixed ID of the tier object
required: true
schema:
$ref: '#/components/schemas/type_ids:TierId'
- name: Authorization
in: header
description: Bearer authentication
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/type_tiers:TierResponse'
'400':
description: Bad Request
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:
name:
type: string
description:
type: string
prices_attributes:
type: array
items:
$ref: '#/components/schemas/type_tiers:UpdateTierPriceRequest'
components:
schemas:
type_tiers:TierPrice:
type: object
properties:
id:
$ref: '#/components/schemas/type_ids:PriceId'
currency:
$ref: '#/components/schemas/type_tiers:TierPriceCurrency'
amount_cents:
type: integer
enabled:
type: boolean
default: true
interval:
$ref: '#/components/schemas/type_tiers:TierPriceInterval'
denominator:
type: string
cta:
type: string
description: When using the external Stripe checkout, this text will be displayed on the button
features:
type: array
items:
type: string
description: Price belonging to a Tier
title: TierPrice
type_tiers:IndexTiersResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/type_tiers:Tier'
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: IndexTiersResponse
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_tiers:TierStatus:
type: string
enum:
- active
- archived
description: Returns whether or not the tier has any active prices.
title: TierStatus
type_tiers:TierPricesAttributesItem:
type: object
properties:
currency:
$ref: '#/components/schemas/type_tiers:TierPriceCurrency'
amount_cents:
type: integer
enabled:
type: boolean
default: true
interval:
$ref: '#/components/schemas/type_tiers:TierPriceInterval'
interval_display:
type: string
cta:
type: string
features:
type: array
items:
type: string
required:
- currency
- amount_cents
- interval
title: TierPricesAttributesItem
type_:ErrorDetail:
type: object
properties:
message:
type: string
code:
type: string
required:
- message
- code
title: ErrorDetail
type_tiers:TierResponse:
type: object
properties:
data:
$ref: '#/components/schemas/type_tiers:Tier'
title: TierResponse
type_tiers:TierPriceCurrency:
type: string
enum:
- usd
- aud
- cad
- eur
- inr
- brl
title: TierPriceCurrency
type_tiers:TierPriceInterval:
type: string
enum:
- month
- quarter
- year
- one_time
- donation
title: TierPriceInterval
type_ids:TierId:
type: string
description: The prefixed ID of the tier.
title: TierId
type_ids:PriceId:
type: string
description: The prefixed ID of the price.
title: PriceId
type_:RequestDirection:
type: string
enum:
- asc
- desc
default: asc
description: The direction of the request. Defaults to `asc`.
title: RequestDirection
type_tiers:UpdateTierPriceRequest:
type: object
properties:
id:
$ref: '#/components/schemas/type_ids:PriceId'
description: ID of the existing price.
currency:
$ref: '#/components/schemas/type_tiers:TierPriceCurrency'
amount_cents:
type: integer
interval:
$ref: '#/components/schemas/type_tiers:TierPriceInterval'
interval_display:
type: string
cta:
type: string
features:
type: array
items:
type: string
delete:
type: boolean
default: false
description: Optionally delete the price when updating the tier.
required:
- id
- currency
- amount_cents
- interval
title: UpdateTierPriceRequest
type_tiers:TierStats:
type: object
properties:
active_subscriptions:
type: integer
description: Total number of active subscriptions belonging to this tier.
required:
- active_subscriptions
description: 'Optional list of stats for a tier. Retrievable by including `expand: [stats]` in the tier request body.'
title: TierStats
type_tiers:Tier:
type: object
properties:
id:
$ref: '#/components/schemas/type_ids:TierId'
name:
type: string
status:
$ref: '#/components/schemas/type_tiers:TierStatus'
description: Returns whether or not the tier has any active prices.
description:
type: string
default: Super engaged readers
stats:
$ref: '#/components/schemas/type_tiers:TierStats'
prices:
type: array
items:
$ref: '#/components/schemas/type_tiers:TierPrice'
description: 'Optional list of prices for a tier. Retrievable by including `expand: [prices]` in the tier request body.'
required:
- id
- name
- status
description: The subscription tier object.
title: Tier
securitySchemes:
BearerAuthScheme:
type: http
scheme: bearer