beehiiv subpackage_workspaces API

The subpackage_workspaces API from beehiiv — 2 operation(s) for subpackage_workspaces.

OpenAPI Specification

beehiiv-subpackage-workspaces-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: API Reference subpackage_advertisement_opportunities subpackage_workspaces API
  version: 1.0.0
servers:
- url: https://api.beehiiv.com/v2
tags:
- name: subpackage_workspaces
paths:
  /workspaces/identify:
    get:
      operationId: identify
      summary: 'Identify workspace <Badge intent="info" minimal outlined>OAuth Scope: identify:read</Badge>'
      description: Retrieve information about the workspace the OAuth or API token is associated with.
      tags:
      - subpackage_workspaces
      parameters:
      - name: Authorization
        in: header
        description: Bearer authentication
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_workspaces:WorkspaceIdentifyResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:Error'
        '403':
          description: Forbidden
          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'
  /workspaces/publications/by_subscription_email/{email}:
    get:
      operationId: publications-by-subscription-email
      summary: 'Get publications by subscription email <Badge intent="info" minimal outlined>OAuth Scope: publications:read</Badge>'
      description: Retrieve all publications in the workspace that have a subscription for the specified email address. The workspace is determined by the provided API key.
      tags:
      - subpackage_workspaces
      parameters:
      - name: email
        in: path
        description: The email address to search for subscriptions
        required: true
        schema:
          type: string
      - name: expand
        in: query
        description: Optionally expand the results by adding additional information. <br>`subscription` - Returns the full Subscription object for the email address in each publication. <br>`publication` - Returns the full Publication object instead of just ID and name. <br>`subscription_custom_fields` - Returns custom field values nested within the subscription object. (Returns the subscription object regardless of whether `subscription` is requested.)
        required: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/type_workspaces:PublicationsBySubscriptionEmailRequestExpandItem'
      - name: Authorization
        in: header
        description: Bearer authentication
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/type_workspaces:PublicationsBySubscriptionEmailResponseItem'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:Error'
        '401':
          description: Unauthorized
          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_:SubscriptionExpandedSubscriptionTier:
      type: string
      enum:
      - free
      - premium
      description: The current tier of the subscription.
      title: SubscriptionExpandedSubscriptionTier
    type_:SubscriptionTags:
      type: array
      items:
        type: string
      description: 'Optional list of tags for a subscription. Retrievable by including `expand: [tags]` in the request body.

        Max limit of 100 unique tags per publication.'
      title: SubscriptionTags
    type_:Publication:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/type_ids:PublicationId'
          description: A unique prefixed id of the publication
        name:
          type: string
          description: The name of the publication
        organization_name:
          type: string
          description: The name of the organization
        referral_program_enabled:
          type: boolean
          description: A boolean field indicating whether the referral program is active for this publication.
        created:
          type: number
          format: double
          description: The time that the publication was created. Measured in seconds since the Unix epoch
        stats:
          $ref: '#/components/schemas/type_:PublicationStats'
      required:
      - id
      - name
      - organization_name
      - referral_program_enabled
      - created
      title: Publication
    type_:SubscriptionTierList:
      type: array
      items:
        $ref: '#/components/schemas/type_:SubscriptionTierInfo'
      description: 'Optional list of tiers for a subscription. Retrievable by including `expand: [subscription_premium_tiers]` in the request body.'
      title: SubscriptionTierList
    type_workspaces:WorkspaceIdentity:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/type_ids:WorkspaceId'
          description: The prefixed ID of the workspace.
        name:
          type: string
          description: The name of the workspace.
        owner_email:
          type: string
          description: The email of the owner of the workspace.
      required:
      - id
      - name
      - owner_email
      title: WorkspaceIdentity
    type_workspaces:WorkspaceIdentifyResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/type_workspaces:WorkspaceIdentity'
      required:
      - data
      title: WorkspaceIdentifyResponse
    type_:SubscriptionExpandedStatus:
      type: string
      enum:
      - validating
      - invalid
      - pending
      - active
      - inactive
      - needs_attention
      - paused
      description: The status of the subscription.<br>`validating` - The email address is being validated.<br>`invalid` - The email address is invalid.<br>`pending` - The email address is valid, but the subscription is pending double opt-in.<br>`active` - The email was valid and the subscription is active.<br>`inactive` - The subscription was made inactive, possibly due to an unsubscribe.<br>`needs_attention` - The subscription requires approval or denial.<br>`paused` - The subscriber has paused their subscription.
      title: SubscriptionExpandedStatus
    type_:SubscriptionExpandedUtmChannel:
      type: string
      enum:
      - ''
      - website
      - import
      - embed
      - api
      - referral
      - recommendation
      - magic_link
      - boost
      - boost_send
      - boost_direct_link
      - integration
      - product
      description: The acquisition channel
      title: SubscriptionExpandedUtmChannel
    type_:CustomField:
      type: object
      properties:
        name:
          type: string
          description: The name of the existing custom field
        kind:
          $ref: '#/components/schemas/type_:CustomFieldType'
          description: The type of value being stored in the custom field.
        value:
          $ref: '#/components/schemas/type_:CustomFieldDataType'
          description: The value stored for the subscription
      title: CustomField
    type_:AverageOpenRate:
      oneOf:
      - type: number
        format: double
      - type: boolean
      description: The publications historical average open rate
      title: AverageOpenRate
    type_:TotalUniqueOpens:
      oneOf:
      - type: integer
      - type: boolean
      description: Total number of uniquely opened emails. Only counts the first open for each subscriber.
      title: TotalUniqueOpens
    type_:SubscriptionStats:
      type: object
      properties:
        emails_received:
          type: integer
          description: The total number of emails that have been sent to this subscriber
        open_rate:
          type: number
          format: double
          description: The percentage of emails that the subscriber has opened
        click_through_rate:
          type: number
          format: double
          description: The percentage of emails that the subscriber has clicked a link in
      description: 'Optional list of stats for a subscription. Retrievable by including `expand: [stats]` in the request body.'
      title: SubscriptionStats
    type_:SubscriptionCustomFieldList:
      type: array
      items:
        $ref: '#/components/schemas/type_:CustomField'
      description: 'Optional list of custom fields for a subscription. Retrievable by including `expand: [custom_field]` in the request body.'
      title: SubscriptionCustomFieldList
    type_:AverageClickRate:
      oneOf:
      - type: number
        format: double
      - type: boolean
      description: The publications historical average click through rate
      title: AverageClickRate
    type_:ErrorDetail:
      type: object
      properties:
        message:
          type: string
        code:
          type: string
      required:
      - message
      - code
      title: ErrorDetail
    type_:TotalClicks:
      oneOf:
      - type: integer
      - type: boolean
      description: The total number of links clicked from emails.
      title: TotalClicks
    type_:CustomFieldDataType:
      oneOf:
      - type: string
      - type: number
        format: double
      - type: boolean
      - type: array
        items:
          type: string
      title: CustomFieldDataType
    type_:Subscription:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/type_ids:SubscriptionId'
          description: The prefixed subscription id
        email:
          type: string
          format: email
        status:
          $ref: '#/components/schemas/type_:SubscriptionExpandedStatus'
          description: The status of the subscription.<br>`validating` - The email address is being validated.<br>`invalid` - The email address is invalid.<br>`pending` - The email address is valid, but the subscription is pending double opt-in.<br>`active` - The email was valid and the subscription is active.<br>`inactive` - The subscription was made inactive, possibly due to an unsubscribe.<br>`needs_attention` - The subscription requires approval or denial.
        created:
          type: integer
          description: The date the subscription was created. Measured in seconds since the Unix epoch
        subscription_tier:
          $ref: '#/components/schemas/type_:SubscriptionExpandedSubscriptionTier'
          description: The current tier of the subscription.
        subscription_premium_tier_names:
          type: array
          items:
            type: string
          description: The current premium tiers of the subscription. Empty if the subscriber is not associated with any premium tiers.
        utm_source:
          type: string
          description: The acquisition source; where the subscriber came from
        utm_medium:
          type: string
          description: The acquisition medium; how the subscriber got to your publication
        utm_channel:
          $ref: '#/components/schemas/type_:SubscriptionExpandedUtmChannel'
          description: The acquisition channel
        utm_campaign:
          type: string
          description: The acquisition campaign
        utm_term:
          type: string
          description: The acquisition term; typically the keyword or search term
        utm_content:
          type: string
          description: The acquisition content; typically used for A/B testing or ad variations
        referring_site:
          type: string
          description: The website that the subscriber was referred from
        referral_code:
          type: string
          description: The code associated to this subscriber to refer others. When a new subscription is created with this referral code, credit for the referral goes to this subscription.
        subscription_premium_tiers:
          $ref: '#/components/schemas/type_:SubscriptionTierList'
        custom_fields:
          $ref: '#/components/schemas/type_:SubscriptionCustomFieldList'
        tags:
          $ref: '#/components/schemas/type_:SubscriptionTags'
        stats:
          $ref: '#/components/schemas/type_:SubscriptionStats'
        newsletter_list_ids:
          type: array
          items:
            type: string
          description: The prefixed IDs of the newsletter lists this subscription is actively subscribed to. Requires `expand[]=newsletter_lists`. <Badge intent="warning" minimal outlined>Beta</Badge>
      required:
      - id
      - email
      - status
      - created
      - subscription_tier
      - subscription_premium_tier_names
      - utm_source
      - utm_medium
      - utm_channel
      - utm_campaign
      - utm_term
      - utm_content
      - referring_site
      - referral_code
      description: The subscription object
      title: Subscription
    type_:ActiveSubscriptionCount:
      oneOf:
      - type: integer
      - type: boolean
      description: Total number of active free and premium subscriptions
      title: ActiveSubscriptionCount
    type_ids:PublicationId:
      type: string
      description: The prefixed ID of the publication.
      title: PublicationId
    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_:SubscriptionTierInfoStatus:
      type: string
      enum:
      - active
      - archived
      description: Returns whether or not the tier has any active prices.
      title: SubscriptionTierInfoStatus
    type_workspaces:PublicationsBySubscriptionEmailRequestExpandItem:
      type: string
      enum:
      - subscription
      - publication
      - subscription_custom_fields
      title: PublicationsBySubscriptionEmailRequestExpandItem
    type_ids:WorkspaceId:
      type: string
      description: The prefixed ID of the workspace.
      title: WorkspaceId
    type_:PublicationStats:
      type: object
      properties:
        active_subscriptions:
          $ref: '#/components/schemas/type_:ActiveSubscriptionCount'
          description: Total number of active free and premium subscriptions
        active_premium_subscriptions:
          $ref: '#/components/schemas/type_:ActivePremiumSubscriptionCount'
          description: Total number of active premium/paid subscriptions
        active_free_subscriptions:
          $ref: '#/components/schemas/type_:ActiveFreeSubscriptionCount'
          description: Total number of active free subscriptions
        average_open_rate:
          $ref: '#/components/schemas/type_:AverageOpenRate'
          description: The publications historical average open rate
        average_click_rate:
          $ref: '#/components/schemas/type_:AverageClickRate'
          description: The publications historical average click through rate
        total_sent:
          $ref: '#/components/schemas/type_:TotalEmailsSent'
          description: Total number of emails sent
        total_unique_opened:
          $ref: '#/components/schemas/type_:TotalUniqueOpens'
          description: Total number of uniquely opened emails. Only counts the first open for each subscriber.
        total_clicked:
          $ref: '#/components/schemas/type_:TotalClicks'
          description: The total number of links clicked from emails.
      description: "Optional list of stats for a publication. Retrievable by including an `expand` array in the publication request body. Add `\"stats\"` to the array to retrieve all, or add individual stats (prefaced with `stat_`) to only retrieve specific ones.\n\nExamples:\n{\n  \"expand\": [\"stats\"]\n}\n\n{\n  \"expand\": [\"stat_active_subscriptions\", \"stat_average_click_rate\"]\n}"
      title: PublicationStats
    type_ids:SubscriptionId:
      type: string
      description: The prefixed ID of the subscription.
      title: SubscriptionId
    type_:SubscriptionTierInfo:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/type_ids:TierId'
        name:
          type: string
        status:
          $ref: '#/components/schemas/type_:SubscriptionTierInfoStatus'
          description: Returns whether or not the tier has any active prices.
      required:
      - id
      - name
      - status
      title: SubscriptionTierInfo
    type_:ActiveFreeSubscriptionCount:
      oneOf:
      - type: integer
      - type: boolean
      description: Total number of active free subscriptions
      title: ActiveFreeSubscriptionCount
    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_workspaces:PublicationsBySubscriptionEmailResponseItem:
      type: object
      properties:
        publication_id:
          $ref: '#/components/schemas/type_ids:PublicationId'
          description: The prefixed ID of the publication
        publication_name:
          type: string
          description: The name of the publication
        subscription_id:
          $ref: '#/components/schemas/type_ids:SubscriptionId'
          description: The prefixed ID of the subscription matching the email address for this publication
        status:
          $ref: '#/components/schemas/type_:SubscriptionExpandedStatus'
          description: The status of the subscription matching the email address for this publication
        publication:
          $ref: '#/components/schemas/type_:Publication'
          description: The full Publication object. Only present when `expand` includes `publication`.
        subscription:
          $ref: '#/components/schemas/type_:Subscription'
          description: The Subscription object matching the email address for this publication.  Only present when `expand` includes `subscription` or `subscription_custom_fields`.
      required:
      - publication_id
      - publication_name
      - subscription_id
      - status
      title: PublicationsBySubscriptionEmailResponseItem
    type_:TotalEmailsSent:
      oneOf:
      - type: integer
      - type: boolean
      description: Total number of emails sent
      title: TotalEmailsSent
    type_ids:TierId:
      type: string
      description: The prefixed ID of the tier.
      title: TierId
    type_:ActivePremiumSubscriptionCount:
      oneOf:
      - type: integer
      - type: boolean
      description: Total number of active premium/paid subscriptions
      title: ActivePremiumSubscriptionCount
  securitySchemes:
    BearerAuthScheme:
      type: http
      scheme: bearer