info:
  title: Developer API
  version: 2.0.0
security:
  - BearerAuth: []
servers:
  - url: https://api.revenuecat.com/v2
openapi: 3.0.3
tags:
  - name: Audience
    description: Operations about audiences.
paths:
  /projects/{project_id}/audiences:
    get:
      summary: Get a list of audiences
      operationId: list-audiences
      x-revenuecat-rate-limiting-domain: audiences
      x-scopes:
        - audiences:audiences:read
      x-release-status: public
      tags:
        - Audience
      parameters:
        - name: project_id
          description: ID of the project
          required: true
          in: path
          schema:
            type: string
            maxLength: 255
            example: proj1ab2c3d4
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAudiences'
          headers:
            RevenueCat-Rate-Limit-Current-Usage:
              $ref: '#/components/headers/RateLimitCurrentUsage'
            RevenueCat-Rate-Limit-Current-Limit:
              $ref: '#/components/headers/RateLimitCurrentLimit'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '423':
          $ref: '#/components/responses/Locked'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/InternalError'
      description: >-
        This endpoint requires the following permission(s):
        <code>audiences:audiences:read</code>. This endpoint belongs to the
        <strong>Audiences</strong> domain, which has a default rate limit of
        <strong>60 requests per minute</strong>.
    post:
      summary: Create an audience
      operationId: create-audience
      x-revenuecat-rate-limiting-domain: audiences
      x-scopes:
        - audiences:audiences:read_write
      x-release-status: public
      tags:
        - Audience
      parameters:
        - name: project_id
          description: ID of the project
          required: true
          in: path
          schema:
            type: string
            maxLength: 255
            example: proj1ab2c3d4
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - rules
              properties:
                name:
                  description: The name of the audience
                  type: string
                  minLength: 1
                  maxLength: 256
                  example: Active subscribers
                rules:
                  description: The audience membership rules
                  $ref: '#/components/schemas/AudienceRules'
              additionalProperties: false
      responses:
        '201':
          description: Success. The audience was created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Audience'
          headers:
            RevenueCat-Rate-Limit-Current-Usage:
              $ref: '#/components/headers/RateLimitCurrentUsage'
            RevenueCat-Rate-Limit-Current-Limit:
              $ref: '#/components/headers/RateLimitCurrentLimit'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '423':
          $ref: '#/components/responses/Locked'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/InternalError'
      description: >-
        This endpoint requires the following permission(s):
        <code>audiences:audiences:read_write</code>. This endpoint belongs to
        the <strong>Audiences</strong> domain, which has a default rate limit of
        <strong>60 requests per minute</strong>.
  /projects/{project_id}/audiences/actions/preview:
    post:
      summary: Preview audience members
      operationId: preview-audience
      x-revenuecat-rate-limiting-domain: audiences
      x-scopes:
        - audiences:audiences:read
      x-release-status: public
      tags:
        - Audience
      parameters:
        - name: project_id
          description: ID of the project
          required: true
          in: path
          schema:
            type: string
            maxLength: 255
            example: proj1ab2c3d4
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/AudiencePreviewById'
                - $ref: '#/components/schemas/AudiencePreviewByRules'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AudiencePreview'
          headers:
            RevenueCat-Rate-Limit-Current-Usage:
              $ref: '#/components/headers/RateLimitCurrentUsage'
            RevenueCat-Rate-Limit-Current-Limit:
              $ref: '#/components/headers/RateLimitCurrentLimit'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '423':
          $ref: '#/components/responses/Locked'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/InternalError'
      description: >-
        This endpoint requires the following permission(s):
        <code>audiences:audiences:read</code>. This endpoint belongs to the
        <strong>Audiences</strong> domain, which has a default rate limit of
        <strong>60 requests per minute</strong>.
  /projects/{project_id}/audiences/filter_options:
    get:
      summary: Get audience filter options
      description: >-
        Returns the known values for audience rule condition fields whose
        options are derived from the project's data (attribution fields, price
        experiments, and custom attributes). Custom attributes are returned as
        dynamic fields using the format `customAttribute:<key>`; requesting
        `customAttribute` expands to every known custom attribute. Fields with a
        fixed set of values (e.g. `country`, `platform`, `status`) are not
        served by this endpoint. This endpoint requires the following
        permission(s): <code>audiences:audiences:read</code>. This endpoint
        belongs to the <strong>Audiences</strong> domain, which has a default
        rate limit of <strong>60 requests per minute</strong>.
      operationId: get-audience-filter-options
      x-revenuecat-rate-limiting-domain: audiences
      x-scopes:
        - audiences:audiences:read
      x-release-status: public
      tags:
        - Audience
      parameters:
        - name: project_id
          description: ID of the project
          required: true
          in: path
          schema:
            type: string
            maxLength: 255
            example: proj1ab2c3d4
        - name: fields
          in: query
          description: >-
            Audience condition fields to load options for. Custom attributes use
            the field format `customAttribute:<key>`; `customAttribute` alone
            expands to every known custom attribute.
          required: true
          schema:
            type: array
            minItems: 1
            items:
              oneOf:
                - type: string
                  enum:
                    - mediaSource
                    - campaign
                    - adGroup
                    - ad
                    - keyword
                    - creative
                    - priceExperimentId
                    - latestProduct
                    - customAttribute
                - type: string
                  pattern: ^customAttribute:[a-zA-Z][a-zA-Z0-9_-]*$
              example: mediaSource
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAudienceFilterOptions'
          headers:
            RevenueCat-Rate-Limit-Current-Usage:
              $ref: '#/components/headers/RateLimitCurrentUsage'
            RevenueCat-Rate-Limit-Current-Limit:
              $ref: '#/components/headers/RateLimitCurrentLimit'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '423':
          $ref: '#/components/responses/Locked'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/InternalError'
  /projects/{project_id}/audiences/{audience_id}:
    get:
      summary: Get an audience
      operationId: get-audience
      x-revenuecat-rate-limiting-domain: audiences
      x-scopes:
        - audiences:audiences:read
      x-expandable-fields:
        - stats: audiences:audiences:read
        - customer_sample: audiences:audiences:read
        - used_by: audiences:audiences:read
      x-release-status: public
      tags:
        - Audience
      parameters:
        - name: project_id
          description: ID of the project
          required: true
          in: path
          schema:
            type: string
            maxLength: 255
            example: proj1ab2c3d4
        - name: audience_id
          description: ID of the audience
          required: true
          in: path
          schema:
            type: string
            minLength: 1
            maxLength: 255
            example: aud1a2b3c4d5e6f7g8
        - name: expand
          in: query
          description: |-
            Specifies which fields in the response should be expanded.
             Accepted values are: `stats` (requires `audiences:audiences:read` permission), `customer_sample` (requires `audiences:audiences:read` permission), `used_by` (requires `audiences:audiences:read` permission).
          required: false
          schema:
            type: array
            items:
              maxLength: 5000
              minLength: 1
              type: string
              enum:
                - stats
                - customer_sample
                - used_by
              example: stats
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Audience'
          headers:
            RevenueCat-Rate-Limit-Current-Usage:
              $ref: '#/components/headers/RateLimitCurrentUsage'
            RevenueCat-Rate-Limit-Current-Limit:
              $ref: '#/components/headers/RateLimitCurrentLimit'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '423':
          $ref: '#/components/responses/Locked'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/InternalError'
      description: >-
        This endpoint requires the following permission(s):
        <code>audiences:audiences:read</code>. This endpoint belongs to the
        <strong>Audiences</strong> domain, which has a default rate limit of
        <strong>60 requests per minute</strong>.
    post:
      summary: Update an audience
      operationId: update-audience
      x-revenuecat-rate-limiting-domain: audiences
      x-scopes:
        - audiences:audiences:read_write
      x-release-status: public
      tags:
        - Audience
      parameters:
        - name: project_id
          description: ID of the project
          required: true
          in: path
          schema:
            type: string
            maxLength: 255
            example: proj1ab2c3d4
        - name: audience_id
          description: ID of the audience
          required: true
          in: path
          schema:
            type: string
            minLength: 1
            maxLength: 255
            example: aud1a2b3c4d5e6f7g8
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              minProperties: 1
              properties:
                name:
                  description: The name of the audience
                  type: string
                  minLength: 1
                  maxLength: 256
                  example: Active subscribers
                rules:
                  description: The audience membership rules
                  $ref: '#/components/schemas/AudienceRules'
              additionalProperties: false
      responses:
        '200':
          description: Success. The audience was updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Audience'
          headers:
            RevenueCat-Rate-Limit-Current-Usage:
              $ref: '#/components/headers/RateLimitCurrentUsage'
            RevenueCat-Rate-Limit-Current-Limit:
              $ref: '#/components/headers/RateLimitCurrentLimit'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '423':
          $ref: '#/components/responses/Locked'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/InternalError'
      description: >-
        This endpoint requires the following permission(s):
        <code>audiences:audiences:read_write</code>. This endpoint belongs to
        the <strong>Audiences</strong> domain, which has a default rate limit of
        <strong>60 requests per minute</strong>.
components:
  schemas:
    ListAudiences:
      type: object
      required:
        - items
        - next_page
        - object
        - url
      title: AudienceList
      properties:
        object:
          description: >-
            String representing the object's type. Objects of the same type
            share the same value. Always has the value `list`.
          enum:
            - list
          type: string
        items:
          description: Details about each object.
          items:
            $ref: '#/components/schemas/Audience'
          type: array
        next_page:
          description: >-
            URL to access the next page. Audiences are not paginated, so this is
            always null.
          type: string
          nullable: true
          example: null
        url:
          description: The URL where this list can be accessed.
          maxLength: 5000
          type: string
          example: /v2/projects/proj1ab2c3d4/audiences
      additionalProperties: false
    AudienceRules:
      type: object
      description: >-
        The audience membership rules. A subscriber matches the audience when
        any group matches (groups are combined with OR); within a group all
        conditions must match (conditions are combined with AND).
      additionalProperties: false
      required:
        - groups
      properties:
        groups:
          description: The condition groups, combined with OR.
          type: array
          items:
            type: object
            additionalProperties: false
            required:
              - conditions
            properties:
              conditions:
                description: The conditions in the group, combined with AND.
                type: array
                items:
                  $ref: '#/components/schemas/AudienceRuleCondition'
      example:
        groups:
          - conditions:
              - field: status
                operator: is
                value: active
    Audience:
      type: object
      required:
        - object
        - id
        - project_id
        - customer_list_id
        - name
        - rules
        - created_at
        - updated_at
      properties:
        object:
          description: >-
            String representing the object's type. Always has the value
            `audience`.
          enum:
            - audience
          type: string
        id:
          description: The id of the audience
          type: string
          minLength: 1
          maxLength: 255
          example: aud1a2b3c4d5e6f7g8
        project_id:
          description: ID of the project to which the audience belongs
          type: string
          minLength: 1
          maxLength: 20
          example: proj1ab2c3d4
        customer_list_id:
          description: ID of the customer list backing the audience
          type: string
          minLength: 1
          maxLength: 255
          example: list1a2b3c4d
        name:
          description: The name of the audience
          type: string
          minLength: 1
          maxLength: 256
          example: Active subscribers
        rules:
          description: The audience membership rules
          $ref: '#/components/schemas/AudienceRules'
        created_at:
          description: The date the audience was created (ms since epoch)
          type: integer
          format: int64
          example: 1658399423658
        updated_at:
          description: The date the audience was last updated (ms since epoch)
          type: integer
          format: int64
          nullable: true
          example: 1658399423658
        stats:
          description: >-
            Aggregate stats for the audience. Only present when requested with
            `expand=stats`.
          $ref: '#/components/schemas/AudiencePreviewStats'
        customer_sample:
          description: >-
            Sample of customers matching the audience. Only present when
            requested with `expand=customer_sample`.
          type: array
          items:
            $ref: '#/components/schemas/AudienceSampleItem'
        used_by:
          description: >-
            Targeting rules and experiments that use this audience. Only present
            when requested with `expand=used_by`.
          $ref: '#/components/schemas/AudienceUsedBy'
      additionalProperties: false
    AudiencePreviewById:
      type: object
      additionalProperties: false
      required:
        - audience_uuid
      properties:
        audience_uuid:
          type: string
          description: UUID of the saved audience.
          example: abc12345
    AudiencePreviewByRules:
      type: object
      additionalProperties: false
      required:
        - rules
      properties:
        rules:
          $ref: '#/components/schemas/AudienceRules'
    AudiencePreview:
      type: object
      additionalProperties: false
      required:
        - object
        - stats
        - customer_sample
      properties:
        object:
          type: string
          enum:
            - audience_preview
          example: audience_preview
        stats:
          $ref: '#/components/schemas/AudiencePreviewStats'
        customer_sample:
          type: array
          items:
            $ref: '#/components/schemas/AudienceSampleItem'
    ListAudienceFilterOptions:
      type: object
      required:
        - items
        - next_page
        - object
        - url
      title: AudienceFilterOptionsList
      properties:
        object:
          description: >-
            String representing the object's type. Objects of the same type
            share the same value. Always has the value `list`.
          enum:
            - list
          type: string
        items:
          description: Details about each object.
          items:
            $ref: '#/components/schemas/AudienceFilterFieldOptions'
          type: array
        next_page:
          description: >-
            URL to access the next page. Filter options are not paginated, so
            this is always null.
          type: string
          nullable: true
          example: null
        url:
          description: The URL where this list can be accessed.
          maxLength: 5000
          type: string
          example: /v2/projects/proj1ab2c3d4/audiences/filter_options
      additionalProperties: false
    Error:
      type: object
      required:
        - type
        - message
        - retryable
        - object
      properties:
        object:
          description: >-
            String representing the object's type. Objects of the same type
            share the same value.
          enum:
            - error
          type: string
          example: error
        type:
          description: The error type
          type: string
          nullable: false
          enum:
            - parameter_error
            - resource_already_exists
            - resource_missing
            - idempotency_error
            - rate_limit_error
            - authentication_error
            - authorization_error
            - store_error
            - server_error
            - resource_locked_error
            - unprocessable_entity_error
            - invalid_request
            - entity_references_archived_entities
          example: parameter_error
        param:
          description: >-
            If the error is parameter-specific, the parameter related to the
            error
          type: string
          nullable: true
          example: customer_id
        doc_url:
          description: A URL to more information about the error reported
          type: string
          nullable: false
          example: https://errors.rev.cat/parameter-error
        message:
          type: string
          description: A message describing the reason of the error
          nullable: false
          example: id shouldn't be longer than 1,500 characters
        retryable:
          description: Indicates if the error is retryable or not
          type: boolean
          nullable: false
          example: false
        backoff_ms:
          description: >-
            The ms the client should wait before retrying the request. Only
            present for retryable errors.
          type: integer
          nullable: true
          example: null
        referenced_object_ids:
          description: >-
            The IDs of related objects relevant to the error, such as the
            archived entities that need to be made active before the operation
            can succeed.
          type: array
          items:
            type: string
          example:
            - prodabcd1234
            - prodwxyz5678
      additionalProperties: false
    AudienceRuleCondition:
      type: object
      description: A single audience rule condition.
      additionalProperties: false
      required:
        - field
        - operator
      properties:
        field:
          description: >-
            The subscriber field evaluated by the condition. Custom subscriber
            attributes are referenced as `customAttribute:<key>` (e.g.
            `customAttribute:plan_tier`).
          example: status
          anyOf:
            - type: string
              enum:
                - country
                - customerId
                - status
                - customerListExportStatus
                - originalAppUserId
                - platform
                - storefront
                - locale
                - appVersion
                - sdkVersion
                - platformVersion
                - lastSeenAt
                - firstSeenAt
                - firstPurchaseAt
                - mostRecentPurchaseAt
                - mostRecentRenewalAt
                - latestExpirationAt
                - trialStartAt
                - trialEndAt
                - subscriptionOptOutAt
                - trialOptOutAt
                - totalRenewals
                - totalSpent
                - latestProduct
                - latestOffer
                - latestOfferType
                - email
                - phoneNumber
                - mediaSource
                - campaign
                - adGroup
                - ad
                - keyword
                - creative
                - idfa
                - idfv
                - gpsAdId
                - priceExperimentId
                - priceExperimentVariant
                - hasMadeSandboxPurchase
                - hasMadeNonSubscriptionPurchase
                - isRcPromo
                - latestStore
                - anyActiveStore
                - latestStoreCountry
                - latestOwnershipType
                - latestPurchasedOffering
                - latestAutoRenewIntent
                - isCurrentlyTrialing
                - latestEntitlements
                - allPurchasedProductIds
                - projectId
                - projectName
                - appConfigId
                - appConfigName
                - appConfigStore
            - type: string
              description: A custom subscriber attribute reference.
              pattern: ^customAttribute:[a-zA-Z][a-zA-Z0-9_-]*$
        operator:
          description: The comparison operator applied to the field.
          type: string
          enum:
            - is
            - isNot
            - isAnyOf
            - isNotAnyOf
            - greaterThan
            - greaterThanOrEqual
            - lessThan
            - lessThanOrEqual
            - equal
            - notEqual
            - contains
            - doesNotContain
            - containsAnyOf
            - before
            - beforeOrOn
            - 'on'
            - after
            - afterOrOn
            - within
            - between
            - notBetween
            - isEmpty
            - isNotEmpty
          example: is
        value:
          description: >-
            The value the field is compared against. May be empty for operators
            that do not take a value (e.g. `isEmpty`, `isNotEmpty`). Multi-value
            operators (`isAnyOf`, `isNotAnyOf`, `containsAnyOf`) take
            comma-separated values. For `latestProduct`, equality operators use
            product ids (`prod...`), while substring operators use raw product
            identifier text. For `anyActiveStore`, use store identifiers such as
            `app_store`.
          type: string
          default: ''
          example: active
        currency:
          description: >-
            Currency for a `totalSpent` comparison. Omitted values are
            interpreted as USD. Must be omitted for `isEmpty` and `isNotEmpty`.
          type: string
          enum:
            - USD
            - EUR
            - GBP
            - AUD
            - CAD
            - JPY
            - BRL
            - KRW
            - CNY
            - MXN
            - SEK
            - PLN
            - NZD
            - CHF
          example: USD
    AudiencePreviewStats:
      type: object
      additionalProperties: false
      required:
        - total_customers
        - active_subscriptions
        - active_trials
        - total_revenue
        - currency
        - is_approximate
      properties:
        total_customers:
          type: integer
          example: 6436
        active_subscriptions:
          type: integer
          example: 4120
        active_trials:
          type: integer
          example: 10
        total_revenue:
          type: number
          format: double
          description: Total revenue in the developer's display currency.
          example: 2630746.46
        currency:
          description: ISO 4217 currency code for monetary values in this preview.
          $ref: '#/components/schemas/Currency'
        is_approximate:
          type: boolean
          description: >-
            Whether these metrics are approximate. When true, counts and revenue
            are estimated from a sample rather than exact.
          example: false
    AudienceSampleItem:
      type: object
      additionalProperties: false
      required:
        - object
        - app_user_id
        - app_uuid
        - status
        - total_spent
        - currency
      properties:
        object:
          type: string
          enum:
            - audience_member
          example: audience_member
        app_user_id:
          type: string
          example: stub_user_1
        app_uuid:
          type: string
          example: 00000000-0000-0000-0000-000000000001
        email:
          type: string
          nullable: true
          example: stub1@example.com
        first_seen_at:
          type: integer
          format: int64
          nullable: true
          description: >-
            Timestamp when the customer was first seen or purchased, in
            milliseconds since epoch.
          example: 1704067200000
        last_seen_at:
          type: integer
          format: int64
          nullable: true
          description: >-
            Timestamp when the customer was last seen, in milliseconds since
            epoch.
          example: 1704153600000
        status:
          type: string
          example: active
        total_spent:
          type: number
          format: float
          nullable: true
          description: >-
            Total gross across the subscriber's subscriptions and one-time
            purchases, in `currency`, or null when no production purchase or
            exchange rate exists.
          example: 129.97
        currency:
          description: ISO 4217 currency code for `total_spent`.
          $ref: '#/components/schemas/Currency'
        latest_product_name:
          type: string
          nullable: true
          description: >-
            Display name of the most recent non-sandbox subscription or one-time
            purchase product, or null if none.
          example: Pro Annual
    AudienceUsedBy:
      type: object
      additionalProperties: false
      required:
        - object
        - targeting_rules
        - experiments
      properties:
        object:
          type: string
          enum:
            - audience_used_by
          example: audience_used_by
        targeting_rules:
          description: Targeting rules that reference this audience
          type: array
          items:
            $ref: '#/components/schemas/AudienceTargetingRuleReference'
        experiments:
          description: Experiments that reference this audience
          type: array
          items:
            $ref: '#/components/schemas/AudienceExperimentReference'
    AudienceFilterFieldOptions:
      type: object
      additionalProperties: false
      required:
        - object
        - field
        - options
      properties:
        object:
          type: string
          enum:
            - audience_filter_field_options
          example: audience_filter_field_options
        field:
          description: The audience rule condition field these options belong to
          oneOf:
            - type: string
              enum:
                - mediaSource
                - campaign
                - adGroup
                - ad
                - keyword
                - creative
                - priceExperimentId
                - latestProduct
            - type: string
              pattern: ^customAttribute:[a-zA-Z][a-zA-Z0-9_-]*$
          example: mediaSource
        options:
          description: The known values for this field
          type: array
          items:
            $ref: '#/components/schemas/AudienceFilterOption'
        cardinality_exceeded:
          description: >-
            Whether additional values exist beyond the stored custom-attribute
            options. Only present for custom-attribute fields.
          type: boolean
          example: false
    Currency:
      type: string
      description: ISO 4217 currency code
      nullable: false
      example: USD
      enum:
        - AED
        - AFN
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BHD
        - BIF
        - BMD
        - BND
        - BOB
        - BRL
        - BSD
        - BTC
        - BTN
        - BWP
        - BYN
        - BZD
        - CAD
        - CDF
        - CHF
        - CLF
        - CLP
        - CNH
        - CNY
        - COP
        - CRC
        - CUC
        - CUP
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ERN
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GGP
        - GHS
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HRK
        - HTG
        - HUF
        - IDR
        - ILS
        - IMP
        - INR
        - IQD
        - IRR
        - ISK
        - JEP
        - JMD
        - JOD
        - JPY
        - KES
        - KGS
        - KHR
        - KMF
        - KPW
        - KRW
        - KWD
        - KYD
        - KZT
        - LAK
        - LBP
        - LKR
        - LRD
        - LSL
        - LYD
        - MAD
        - MDL
        - MGA
        - MKD
        - MMK
        - MNT
        - MOP
        - MRU
        - MUR
        - MVR
        - MWK
        - MXN
        - MYR
        - MZN
        - NAD
        - NGN
        - NIO
        - NOK
        - NPR
        - NZD
        - OMR
        - PAB
        - PEN
        - PGK
        - PHP
        - PKR
        - PLN
        - PYG
        - QAR
        - RON
        - RSD
        - RUB
        - RWF
        - SAR
        - SBD
        - SCR
        - SDG
        - SEK
        - SGD
        - SHP
        - SLL
        - SOS
        - SRD
        - SSP
        - STD
        - STN
        - SVC
        - SYP
        - SZL
        - THB
        - TJS
        - TMT
        - TND
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - UYU
        - UZS
        - VEF
        - VES
        - VND
        - VUV
        - WST
        - XAF
        - XAG
        - XAU
        - XCD
        - XDR
        - XOF
        - XPD
        - XPF
        - XPT
        - YER
        - ZAR
        - ZMW
        - ZWL
    AudienceTargetingRuleReference:
      type: object
      additionalProperties: false
      required:
        - object
        - id
        - display_name
        - state
      properties:
        object:
          type: string
          enum:
            - targeting_rule_reference
          example: targeting_rule_reference
        id:
          description: The id of the targeting rule
          type: string
          example: a1b2c3d4e5
        display_name:
          description: The display name of the targeting rule
          type: string
          example: US iOS users
        state:
          description: Whether the targeting rule is currently active
          type: string
          enum:
            - active
            - inactive
          example: active
    AudienceExperimentReference:
      type: object
      additionalProperties: false
      required:
        - object
        - id
        - display_name
        - status
      properties:
        object:
          type: string
          enum:
            - experiment_reference
          example: experiment_reference
        id:
          description: The id of the experiment
          type: string
          example: exp1a2b3c4d5e6f7
        display_name:
          description: The display name of the experiment
          type: string
          example: Paywall price test
        status:
          description: The status of the experiment
          type: string
          enum:
            - draft
            - running
            - paused
            - stopped
          example: running
    AudienceFilterOption:
      type: object
      additionalProperties: false
      required:
        - object
        - id
        - display_name
      properties:
        object:
          type: string
          enum:
            - audience_filter_option
          example: audience_filter_option
        id:
          description: The option value to use in an audience rule condition
          type: string
          example: Facebook Ads
        display_name:
          description: The display name of the option
          type: string
          example: Facebook Ads
  headers:
    RateLimitCurrentUsage:
      required: true
      description: >-
        The current number of requests used for the current limit (including the
        current request).
      schema:
        type: integer
      example: 25
    RateLimitCurrentLimit:
      required: true
      description: The rate limit for this endpoint, expressed in requests per minute.
      schema:
        type: integer
      example: 30
    RateLimitRetryAfter:
      required: true
      description: >-
        The number of seconds to wait before retrying a rate limited
        request.Only present when a request is rate limited.
      schema:
        type: integer
      example: 10
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - parameter_error
                      - invalid_request
          examples:
            parameter_error:
              value:
                object: error
                type: parameter_error
                param: customer_id
                message: id is too long
                retryable: false
                doc_url: https://errors.rev.cat/parameter-error
            invalid_request:
              value:
                object: error
                type: invalid_request
                message: Content-Type not application/json
                retryable: false
                doc_url: https://errors.rev.cat/invalid-request
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - authentication_error
            example:
              object: error
              type: authentication_error
              message: Invalid API key
              retryable: false
              doc_url: https://errors.rev.cat/authentication-error
    Forbidden:
      description: Access denied
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - authorization_error
            example:
              object: error
              type: authorization_error
              message: You're not authorized to access this resource
              retryable: false
              doc_url: https://errors.rev.cat/authorization-error
    NotFound:
      description: Not found
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - resource_missing
            example:
              object: error
              type: resource_missing
              message: Resource not found
              retryable: false
              doc_url: https://errors.rev.cat/resource-missing
    Locked:
      description: Locked
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - resource_locked_error
            example:
              object: error
              type: resource_locked_error
              message: The resource is currently being modified by a concurrent request
              retryable: true
              doc_url: https://errors.rev.cat/resource-locked-error
              backoff_ms: 1000
    RateLimited:
      description: >-
        The request could not be completed because the rate limiting domain for
        this endpoint is currently at its limit for this project.
      headers:
        RevenueCat-Rate-Limit-Current-Usage:
          $ref: '#/components/headers/RateLimitCurrentUsage'
        RevenueCat-Rate-Limit-Current-Limit:
          $ref: '#/components/headers/RateLimitCurrentLimit'
        Retry-After:
          $ref: '#/components/headers/RateLimitRetryAfter'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - rate_limit_error
            example:
              object: error
              type: rate_limit_error
              message: Rate limit exceeded
              retryable: true
              doc_url: https://errors.rev.cat/rate-limit-error
              backoff_ms: 1000
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - server_error
            example:
              object: error
              type: server_error
              message: There was an internal server error
              retryable: true
              doc_url: https://errors.rev.cat/server-error
              backoff_ms: 1000
    Conflict:
      description: Conflict
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - resource_already_exists
                      - idempotency_error
                      - invalid_request
          examples:
            resource_already_exists:
              value:
                object: error
                type: resource_already_exists
                message: Name is already taken
                retryable: false
                doc_url: https://errors.rev.cat/resource-already-exists
            idempotency_error:
              value:
                object: error
                type: idempotency_error
                message: Idempotency key already used for a different request
                retryable: false
                doc_url: https://errors.rev.cat/idempotency-error
            invalid_request:
              value:
                object: error
                type: invalid_request
                message: Request conflicts with the current resource state
                retryable: false
                doc_url: https://errors.rev.cat/invalid-request
    UnprocessableEntity:
      description: Unprocessable entity
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - unprocessable_entity_error
                      - parameter_error
                      - store_error
                      - entity_references_archived_entities
          examples:
            unprocessable_entity:
              value:
                object: error
                type: unprocessable_entity_error
                message: Cannot delete a product that has purchases
                retryable: false
                doc_url: https://errors.rev.cat/unprocessable-entity-error
            parameter_error:
              value:
                object: error
                type: parameter_error
                message: Date must in the future
                retryable: false
                doc_url: https://errors.rev.cat/parameter-error
            store_error:
              value:
                object: error
                type: store_error
                message: There was a problem on the App Store
                retryable: true
                doc_url: https://errors.rev.cat/store-error
                backoff_ms: 1000
            entity_references_archived_entities:
              value:
                object: error
                type: entity_references_archived_entities
                message: >-
                  This offering references inactive products. You will need to
                  make the products active first before making the offering
                  active.
                retryable: false
                doc_url: https://errors.rev.cat/entity-references-archived-entities
                referenced_object_ids:
                  - prodabcd1234
                  - prodwxyz5678
  securitySchemes:
    BearerAuth:
      bearerFormat: auth-scheme
      description: >-
        Bearer HTTP authentication. Allowed headers -- Authorization: Bearer
        <api_key>
      scheme: bearer
      type: http
