> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slickerhq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add subscriptions



## OpenAPI

````yaml api.yaml POST /v1/subscriptions
openapi: 3.0.1
info:
  title: ingest/v1/ingest.proto
  version: version not set
  description: API for ingesting billing data into Slicker
servers:
  - url: https://api.slickerhq.com/ingest
security:
  - bearerAuth: []
tags:
  - name: IngestService
    description: Services for ingesting billing data into Slicker
paths:
  /v1/subscriptions:
    post:
      tags:
        - IngestService
      summary: Ingest subscriptions into the system
      description: |
        Upload one or more subscriptions to be processed by Slicker.
        Requires authentication with a valid API key passed as a Bearer token.
        Maximum of 200 subscriptions per request.
      operationId: IngestService_IngestSubscriptions
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionsRequest'
            example:
              subscriptions:
                - id: sub_12345678
                  state: SUBSCRIPTION_STATE_ACTIVE
                  customerId: cus_87654321
                  businessEntity: ACME Inc.
                  planId: plan_premium_monthly
                  amount: 2000
                  currency: USD
                  createdAt: '2023-01-01T00:00:00Z'
                  updatedAt: '2023-01-05T12:30:00Z'
                  activatedAt: '2023-01-01T00:00:00Z'
                  expiresAt: '2023-04-01T00:00:00Z'
                  billingPeriod: 1
                  billingPeriodUnit: BILLING_PERIOD_UNIT_MONTH
                - id: sub_87654321
                  state: SUBSCRIPTION_STATE_CANCELED
                  customerId: cus_12345678
                  businessEntity: ACME Inc.
                  planId: plan_basic_annual
                  amount: 10000
                  currency: USD
                  createdAt: '2022-10-01T00:00:00Z'
                  updatedAt: '2023-01-10T09:15:00Z'
                  activatedAt: '2022-10-01T00:00:00Z'
                  canceledAt: '2023-01-10T09:15:00Z'
                  expiresAt: '2023-10-01T00:00:00Z'
                  billingPeriod: 1
                  billingPeriodUnit: BILLING_PERIOD_UNIT_YEAR
        required: true
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionsResponse'
        '400':
          description: Bad Request - The request contains invalid parameters or payload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
              example:
                code: 400
                message: 'Invalid subscription data: missing required fields'
                details: []
        '401':
          description: Unauthorized - Authentication credentials are missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
              example:
                code: 401
                message: 'Unauthorized: missing or invalid API key in Bearer token'
                details: []
        '403':
          description: >-
            Forbidden - The authenticated user doesn't have permission to access
            this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
              example:
                code: 403
                message: 'Forbidden: insufficient permissions to ingest subscriptions'
                details: []
        '429':
          description: Too Many Requests - The rate limit has been exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
              example:
                code: 429
                message: 'Rate limit exceeded: try again later'
                details: []
        '500':
          description: Internal Server Error - An unexpected server error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
              example:
                code: 500
                message: Internal server error
                details: []
        default:
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionsResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    SubscriptionsRequest:
      type: object
      description: >-
        Request to ingest subscription data. Maximum of 200 subscriptions per
        request.
      properties:
        subscriptions:
          type: array
          items:
            $ref: '#/components/schemas/Subscription'
    SubscriptionsResponse:
      type: object
      properties:
        requestId:
          type: string
          description: Unique identifier for tracking the request through the system
          example: req_2uqkAo1bwllmzrgV2qtGv48DtGI
    rpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
    Subscription:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the subscription
          example: sub_12345678
        state:
          $ref: '#/components/schemas/SubscriptionState'
          description: Current state of the subscription
          example: SUBSCRIPTION_STATE_ACTIVE
        customerId:
          type: string
          description: Unique identifier for the customer
          example: cus_87654321
        businessEntity:
          type: string
          description: Business entity associated with this record
          example: ACME Inc.
        planId:
          type: string
          description: Unique identifier for the subscription plan
          example: plan_premium_monthly
        amount:
          type: integer
          format: int32
          description: Monetary amount in smallest unit (e.g., cents)
          example: 2000
        currency:
          type: string
          description: Three-letter ISO 4217 currency code
          example: USD
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the subscription was created
          example: '2023-01-01T00:00:00Z'
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the subscription was last updated
          example: '2023-01-05T12:30:00Z'
        activatedAt:
          type: string
          format: date-time
          description: Timestamp when the subscription was activated
          example: '2023-01-01T00:00:00Z'
        canceledAt:
          type: string
          format: date-time
          description: Timestamp when the subscription was canceled, if applicable
          example: '2023-03-01T00:00:00Z'
        expiresAt:
          type: string
          format: date-time
          description: Timestamp when the subscription expires, if applicable
          example: '2023-04-01T00:00:00Z'
        billingPeriod:
          type: integer
          format: int32
          description: The billing period length (e.g. 1 for every 1 month/week/year)
          example: 1
        billingPeriodUnit:
          $ref: '#/components/schemas/BillingPeriodUnit'
          description: The unit for the billing period
          example: BILLING_PERIOD_UNIT_MONTH
      required:
        - id
    protobufAny:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties:
        type: object
    SubscriptionState:
      type: string
      default: SUBSCRIPTION_STATE_UNSPECIFIED
      enum:
        - SUBSCRIPTION_STATE_UNSPECIFIED
        - SUBSCRIPTION_STATE_ACTIVE
        - SUBSCRIPTION_STATE_CANCELED
        - SUBSCRIPTION_STATE_EXPIRED
        - SUBSCRIPTION_STATE_PAUSED
        - SUBSCRIPTION_STATE_TRIAL
    BillingPeriodUnit:
      type: string
      default: BILLING_PERIOD_UNIT_UNSPECIFIED
      enum:
        - BILLING_PERIOD_UNIT_UNSPECIFIED
        - BILLING_PERIOD_UNIT_DAY
        - BILLING_PERIOD_UNIT_WEEK
        - BILLING_PERIOD_UNIT_MONTH
        - BILLING_PERIOD_UNIT_YEAR
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: |
        API key authentication using a Bearer token in the Authorization header.
        Example: `Authorization: Bearer YOUR_API_KEY`

````