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

# Create subscription

> Create a subscription.



## OpenAPI

````yaml https://platform.runonatlas.com/external/schema post /external/subscriptions
openapi: 3.0.0
info:
  title: Atlas API
  version: 1.0.0
servers:
  - url: https://platform.runonatlas.com
security: []
paths:
  /external/subscriptions:
    post:
      tags:
        - Subscriptions
      summary: Create subscription
      description: Create a subscription.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                currency:
                  type: string
                  nullable: true
                  enum:
                    - USD
                  description: The currency for this subscription
                  example: USD
                endDate:
                  anyOf:
                    - type: string
                      format: date
                    - type: string
                      format: date-time
                    - nullable: true
                  description: The end date of the subscription
                  example: '2021-12-31T00:00:00.000Z'
                netTerms:
                  type: string
                  nullable: true
                  enum:
                    - uponReceipt
                    - net30
                    - net60
                    - net90
                  description: >-
                    The net terms for this subscription; applies only if
                    autoChargeInvoice is false. Determines the number of days
                    after the invoice is issued before the payment is due.
                  example: net30
                startDate:
                  anyOf:
                    - type: string
                      format: date
                    - type: string
                      format: date-time
                  description: The start date of the subscription
                  example: '2021-01-01T00:00:00.000Z'
                allowCustomerChanges:
                  type: boolean
                  default: true
                  description: >-
                    Whether the customer can change the subscription, for
                    example by cancelling it or creating another.
                  example: true
                autoChargeInvoice:
                  type: boolean
                  description: >-
                    Whether to automatically charge invoices for this
                    subscription to the associated payment gateway. Requires a
                    valid Stripe connection. Only compatible with a Stripe
                    payment gateway.
                  example: false
                autoSyncInvoice:
                  type: boolean
                  description: >-
                    Whether to automatically sync invoices for this subscription
                    to the associated payment gateway.
                  example: true
                autoSendInvoice:
                  type: boolean
                  description: >-
                    Whether to automatically send invoices for this subscription
                    from the associated payment gateway to the customers email
                    address.
                  example: true
                paymentGateway:
                  type: string
                  nullable: true
                  enum:
                    - Stripe
                    - QuickBooks
                    - Xero
                  description: The selected payment gateway for this subscription
                  example: Stripe
                customerId:
                  type: string
                  minLength: 1
                  description: The Atlas customer ID
                  example: atlas-internal-customer-id-123
                planId:
                  type: string
                  minLength: 1
                  description: The Atlas plan ID
                  example: atlas-internal-plan-id-123
                invoiceGenerationStartDate:
                  anyOf:
                    - type: string
                      format: date
                    - type: string
                      format: date-time
                  description: >-
                    The date from which invoices should be generated. If
                    ommitted, invoices will be generated from the subscription
                    startDate. If set, no invoices will be generated until this
                    date.
                  example: '2021-01-01T00:00:00.000Z'
              required:
                - startDate
                - autoChargeInvoice
                - autoSyncInvoice
                - autoSendInvoice
                - customerId
                - planId
              additionalProperties: false
      responses:
        '201':
          description: The subscription that has been created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  billingCadence:
                    type: string
                    nullable: true
                    enum:
                      - oneTime
                      - monthly
                      - quarterly
                      - annually
                    description: The billing cadence for this subscription
                    example: monthly
                  createdAt:
                    type: string
                    format: date
                    description: The date and time the subscription was created
                    example: '2021-01-01T00:00:00.000Z'
                  currency:
                    type: string
                    nullable: true
                    enum:
                      - USD
                    description: The currency for this subscription
                    example: USD
                  endDate:
                    anyOf:
                      - type: string
                        format: date
                      - type: string
                        format: date-time
                      - nullable: true
                    description: The end date of the subscription
                    example: '2021-12-31T00:00:00.000Z'
                  id:
                    type: string
                    minLength: 1
                    description: The Atlas subscription ID
                    example: atlas-internal-subscription-id-123
                  netTerms:
                    type: string
                    nullable: true
                    enum:
                      - uponReceipt
                      - net30
                      - net60
                      - net90
                    description: >-
                      The net terms for this subscription; applies only if
                      autoChargeInvoice is false. Determines the number of days
                      after the invoice is issued before the payment is due.
                    example: net30
                  startDate:
                    anyOf:
                      - type: string
                        format: date
                      - type: string
                        format: date-time
                    description: The start date of the subscription
                    example: '2021-01-01T00:00:00.000Z'
                  status:
                    type: string
                    enum:
                      - draft
                      - pendingActivation
                      - active
                      - ended
                      - deleted
                    description: The status of the subscription
                    example: active
                  updatedAt:
                    type: string
                    format: date
                    description: The date and time the subscription was last updated
                    example: '2021-01-01T00:00:00.000Z'
                  allowCustomerChanges:
                    type: boolean
                    description: >-
                      Whether the customer can change the subscription, for
                      example by cancelling it or creating another.
                    example: true
                  autoChargeInvoice:
                    type: boolean
                    description: >-
                      Whether to automatically charge invoices for this
                      subscription to the associated payment gateway. Requires a
                      valid Stripe connection. Only compatible with a Stripe
                      payment gateway.
                    example: false
                  autoSyncInvoice:
                    type: boolean
                    description: >-
                      Whether to automatically sync invoices for this
                      subscription to the associated payment gateway.
                    example: true
                  autoSendInvoice:
                    type: boolean
                    description: >-
                      Whether to automatically send invoices for this
                      subscription from the associated payment gateway to the
                      customers email address.
                    example: true
                  paymentGateway:
                    type: string
                    nullable: true
                    enum:
                      - Stripe
                      - QuickBooks
                      - Xero
                    description: The selected payment gateway for this subscription
                    example: Stripe
                  isTrial:
                    type: boolean
                    description: Whether this subscription is a trial subscription
                    example: false
                  chargeForUsageBasedPricesDuringTrial:
                    type: boolean
                    nullable: true
                    description: >-
                      Whether to charge for usage-based prices during the trial
                      period. Only applies if isTrial is true.
                    example: false
                  customerId:
                    type: string
                    minLength: 1
                    description: The Atlas customer ID
                    example: atlas-internal-customer-id-123
                  planId:
                    type: string
                    minLength: 1
                    description: The Atlas plan ID
                    example: atlas-internal-plan-id-123
                  merchantId:
                    type: string
                    minLength: 1
                    description: The Atlas merchant ID
                    example: atlas-internal-merchant-id-123
                required:
                  - createdAt
                  - id
                  - startDate
                  - status
                  - updatedAt
                  - allowCustomerChanges
                  - autoChargeInvoice
                  - autoSyncInvoice
                  - autoSendInvoice
                  - paymentGateway
                  - isTrial
                  - customerId
                  - planId
                  - merchantId
        '400':
          description: >-
            There is an issue with the request data. See the response for more
            details.
        '401':
          description: Invalid API key provided.
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: x-api-key
      in: header
      description: >-
        You can obtain this key from the Atlas dashboard. It must be of type
        `secret`

````