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

# Create checkout session

> Creates a mixed checkout: a $1 setup fee plus a subscription with a 3-day free trial. The $1 setup fee is automatically detected and refunded by the DodoPayments webhook handler after checkout completes.



## OpenAPI

````yaml /api-reference/openapi.json post /billing/checkout
openapi: 3.1.0
info:
  title: Autoposting API
  description: >-
    Schedule, publish, and AI-enhance social content across X, LinkedIn,
    Instagram, Threads, and YouTube. All responses use the `{ "success":
    boolean, "data": ... }` envelope. Authenticate with an API key
    (`Authorization: Bearer sk-social-...` or `x-api-key: sk-social-...`).
  version: 1.0.0
servers:
  - url: https://app.autoposting.ai/api-proxy
    description: Production
security:
  - bearerAuth: []
  - apiKeyHeader: []
tags:
  - name: Agents
    description: >-
      Create and manage AI agents that autonomously generate and schedule
      content, trigger runs, inspect outputs, and track statistics.
  - name: API Keys
    description: >-
      Create, list, update, and revoke API keys for programmatic access to the
      Autoposting.ai API.
  - name: Auth
    description: >-
      Signup, login, logout, social login, profile management, email change, and
      session management.
  - name: Billing
    description: >-
      Manage subscriptions, credits, plan changes, billing history, and the
      customer portal.
  - name: Brands
    description: >-
      Create, list, update, delete, and reorder brands. Each brand maps to a set
      of social media accounts.
  - name: Carousels
    description: >-
      Create, manage, and AI-generate carousel posts for LinkedIn and other
      platforms.
  - name: Clips
    description: >-
      Upload, manage, render, and publish video clips, including multipart
      upload, AI candidate generation, and credit billing.
  - name: Knowledge Base
    description: >-
      Knowledge bases, document ingestion, semantic search, and AI content idea
      generation.
  - name: Notifications
    description: List, read, and manage in-app notifications and notification preferences.
  - name: Organizations
    description: >-
      Create, list, update, and delete organizations (workspaces), including a
      safeguarded deletion flow with a grace period.
  - name: Platform OAuth
    description: >-
      Connect social media accounts via OAuth and manage platform tokens for X,
      LinkedIn, Instagram, Threads, and YouTube.
  - name: Posts
    description: Create, manage, schedule, publish, and AI-enhance posts across platforms.
  - name: Teams
    description: >-
      Manage team members, invitations, invite links, permission groups,
      brand-level overrides, ownership transfers, and allowed email domains.
  - name: Usage
    description: >-
      Usage summaries, token breakdowns, feature access, onboarding progress,
      and account management endpoints.
  - name: Webhooks
    description: >-
      Configure outbound webhook endpoints to receive real-time event
      notifications from Autoposting.ai.
paths:
  /billing/checkout:
    post:
      tags:
        - Billing
      summary: Create checkout session
      description: >-
        Creates a mixed checkout: a $1 setup fee plus a subscription with a
        3-day free trial. The $1 setup fee is automatically detected and
        refunded by the DodoPayments webhook handler after checkout completes.
      operationId: createBillingCheckout
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                planId:
                  type: string
                  description: ID of the subscription plan to purchase.
                successUrl:
                  type: string
                  format: uri
                  description: URL to redirect to after successful checkout.
                cancelUrl:
                  type: string
                  format: uri
                  description: URL to redirect to if checkout is cancelled.
              required:
                - planId
                - successUrl
                - cancelUrl
            example:
              planId: plan_pro
              successUrl: https://app.acme.com/billing/success
              cancelUrl: https://app.acme.com/billing/cancel
      responses:
        '200':
          description: Checkout session created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: true
                  data:
                    $ref: '#/components/schemas/CheckoutSession'
                required:
                  - success
                  - data
              example:
                success: true
                data:
                  checkoutUrl: https://checkout.dodopayments.com/c/pay_abc123
                  sessionId: cs_abc123
        '401':
          description: Authentication required or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error: unauthorized
                message: Missing or invalid API key.
        '403':
          description: Billing suspended. Subscription expired, cancelled, or past due.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error: billing_suspended
                message: Subscription expired, cancelled, or past due.
components:
  schemas:
    CheckoutSession:
      type: object
      properties:
        checkoutUrl:
          type: string
          format: uri
        sessionId:
          type: string
      required:
        - checkoutUrl
        - sessionId
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          const: false
        error:
          type: string
        message:
          type: string
      required:
        - success
        - error
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'API key as `Authorization: Bearer sk-social-...`'
    apiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: 'API key as `x-api-key: sk-social-...`'

````