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

# Get Subscription

> Retrieves the active subscription for the authenticated device and specified application.



## OpenAPI

````yaml GET /subscription
openapi: 3.1.0
info:
  title: utilsio API
  description: Integrating crypto subscriptions to SaaS apps
  version: 1.0.0
  license:
    name: MIT
servers:
  - url: https://utilsio.dev/api/v1
    description: Production API
security:
  - signatureAuth: []
paths:
  /subscription:
    get:
      summary: Get subscription
      description: >-
        Retrieves the active subscription for the authenticated device and
        specified application.
      operationId: getSubscription
      parameters:
        - name: appId
          in: query
          required: true
          description: The application ID to retrieve the subscription for
          schema:
            type: string
        - name: X-utilsio-Signature
          in: header
          required: true
          description: HMAC signature for request authentication
          schema:
            type: string
        - name: X-utilsio-Timestamp
          in: header
          required: true
          description: Unix timestamp for request signing
          schema:
            type: string
      responses:
        '200':
          description: Active subscription for the app, or null if none exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSubscriptionResponse'
              examples:
                withSubscription:
                  value:
                    success: true
                    subscription:
                      id: sub_abc123
                      amountPerDay: '1.5'
                      createdAt: '2024-01-15T10:30:00.000Z'
                withoutSubscription:
                  value:
                    success: true
                    subscription: null
        '400':
          description: appId is required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSubscriptionResponse'
              examples:
                missingAppId:
                  value:
                    success: false
                    error: appId is required
        '401':
          description: Authentication headers missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSubscriptionResponse'
              examples:
                missingHeaders:
                  value:
                    success: false
                    error: >-
                      X-utilsio-Signature and X-utilsio-Timestamp headers are
                      required
        '500':
          description: Failed to get subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSubscriptionResponse'
              examples:
                serverError:
                  value:
                    success: false
                    error: Failed to get subscription
components:
  schemas:
    GetSubscriptionResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the request was successful
        subscription:
          type: object
          description: The active subscription object, or null if none exists
          properties:
            id:
              type: string
              description: Unique identifier for the subscription
            amountPerDay:
              type: string
              description: Daily subscription amount in USD
            createdAt:
              type: string<date-time>
              description: ISO 8601 timestamp when the subscription was created
          required:
            - id
            - amountPerDay
            - createdAt
        error:
          type: string
          description: Error message if the request failed
  securitySchemes:
    signatureAuth:
      type: apiKey
      in: header
      name: X-utilsio-Signature

````