Autoposting.ai Billing API
Manage subscriptions, credits, plan changes, billing history, and the customer portal.
Manage subscriptions, credits, plan changes, billing history, and the customer portal.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/autoposting-ai:autoposting-ai-billing-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Autoposting Billing 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: Billing
description: Manage subscriptions, credits, plan changes, billing history, and the customer portal.
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.
/billing/verify-checkout:
post:
tags:
- Billing
summary: Verify checkout and activate trial
description: Call this after the user returns from checkout to confirm payment and activate the trial state.
operationId: verifyBillingCheckout
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
sessionId:
type: string
description: Checkout session ID returned from the checkout endpoint.
required:
- sessionId
example:
sessionId: cs_abc123
responses:
'200':
description: Checkout verified and trial activated.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
$ref: '#/components/schemas/VerifyCheckoutResult'
required:
- success
- data
example:
success: true
data:
status: trialing
trialEnd: '2024-01-04T00:00:00Z'
planId: plan_pro
'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.
/billing/status:
get:
tags:
- Billing
summary: Get current billing status
operationId: getBillingStatus
responses:
'200':
description: Current billing status.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
$ref: '#/components/schemas/BillingStatus'
required:
- success
- data
examples:
active:
summary: Active subscription
value:
success: true
data:
status: active
planId: plan_pro
planName: Pro
isTrialing: false
trialEnd: null
currentPeriodEnd: '2024-02-01T00:00:00Z'
cancelAtPeriodEnd: false
pendingPlanChange: null
trialing:
summary: Trialing
value:
success: true
data:
status: trialing
planId: plan_pro
planName: Pro
isTrialing: true
trialEnd: '2024-01-04T00:00:00Z'
currentPeriodEnd: '2024-02-01T00:00:00Z'
suspended:
summary: Suspended
value:
success: true
data:
status: suspended
planId: null
isTrialing: false
'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.
/billing/change-plan:
post:
tags:
- Billing
summary: Change subscription plan
description: Schedule a plan change at the end of the current billing period.
operationId: changeBillingPlan
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
planId:
type: string
description: New plan ID to switch to.
required:
- planId
example:
planId: plan_business
responses:
'200':
description: Plan change scheduled.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
$ref: '#/components/schemas/PlanChangeResult'
required:
- success
- data
example:
success: true
data:
currentPlanId: plan_pro
pendingPlanId: plan_business
effectiveAt: '2024-02-01T00:00:00Z'
'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.
delete:
tags:
- Billing
summary: Cancel a pending plan change
description: Reverts a scheduled plan change before it takes effect.
operationId: cancelBillingPlanChange
responses:
'200':
description: Pending plan change reverted.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
type: object
properties:
cancelled:
type: boolean
required:
- cancelled
required:
- success
- data
example:
success: true
data:
cancelled: true
'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.
/billing/portal-session:
post:
tags:
- Billing
summary: Create billing portal session
description: Create a Stripe/DodoPayments customer portal session for self-serve billing management (update payment method, view invoices, cancel subscription).
operationId: createBillingPortalSession
responses:
'200':
description: Portal session created.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
$ref: '#/components/schemas/PortalSession'
required:
- success
- data
example:
success: true
data:
portalUrl: https://billing.dodopayments.com/p/session_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.
/billing/history:
get:
tags:
- Billing
summary: Get billing history
operationId: getBillingHistory
responses:
'200':
description: Billing history.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
$ref: '#/components/schemas/BillingHistory'
required:
- success
- data
example:
success: true
data:
invoices:
- id: inv_abc123
amount: 4900
currency: usd
status: paid
description: Pro Plan - January 2024
paidAt: '2024-01-01T00:00:00Z'
invoiceUrl: https://...
'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.
/billing/credits/purchase:
post:
tags:
- Billing
summary: Purchase additional credits
description: Purchase additional credits on top of the monthly allocation.
operationId: purchaseCredits
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
amount:
type: number
description: Number of credits to purchase.
required:
- amount
example:
amount: 100
responses:
'200':
description: Credits purchased.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
$ref: '#/components/schemas/CreditPurchaseResult'
required:
- success
- data
example:
success: true
data:
purchased: 100
newBalance: 550
chargedAmount: 999
currency: usd
'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.
'402':
description: Insufficient credits for the requested operation.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
success: false
error: insufficient_credits
message: Not enough credits for the requested operation.
'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.
/billing/credits:
get:
tags:
- Billing
summary: Get credit balance
operationId: getCreditBalance
responses:
'200':
description: Current credit balance.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
$ref: '#/components/schemas/CreditBalance'
required:
- success
- data
example:
success: true
data:
balance: 450
monthlyAllocation: 500
resetAt: '2024-02-01T00:00:00Z'
'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.
/billing/credit-summary:
get:
tags:
- Billing
summary: Get detailed credit summary
description: Detailed breakdown of credit usage by operation type.
operationId: getCreditSummary
responses:
'200':
description: Detailed credit summary.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
const: true
data:
$ref: '#/components/schemas/CreditSummary'
required:
- success
- data
example:
success: true
data:
balance: 450
monthlyAllocation: 500
used: 50
breakdown:
clips: 30
aiGeneration: 15
other: 5
resetAt: '2024-02-01T00:00:00Z'
'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.
components:
schemas:
CreditBalance:
type: object
properties:
balance:
type: integer
monthlyAllocation:
type: integer
resetAt:
type: string
format: date-time
required:
- balance
- monthlyAllocation
- resetAt
CreditPurchaseResult:
type: object
properties:
purchased:
type: integer
newBalance:
type: integer
chargedAmount:
type: integer
description: Amount charged in the smallest currency unit (e.g. cents).
currency:
type: string
required:
- purchased
- newBalance
- chargedAmount
- currency
BillingHistory:
type: object
properties:
invoices:
type: array
items:
$ref: '#/components/schemas/Invoice'
required:
- invoices
Invoice:
type: object
properties:
id:
type: string
amount:
type: integer
description: Amount in the smallest currency unit (e.g. cents).
currency:
type: string
status:
type: string
description:
type: string
paidAt:
type: string
format: date-time
invoiceUrl:
type: string
format: uri
required:
- id
- amount
- currency
- status
BillingStatus:
type: object
properties:
status:
type: string
enum:
- active
- trialing
- suspended
planId:
type:
- string
- 'null'
planName:
type: string
isTrialing:
type: boolean
trialEnd:
type:
- string
- 'null'
format: date-time
currentPeriodEnd:
type: string
format: date-time
cancelAtPeriodEnd:
type: boolean
pendingPlanChange:
type:
- object
- 'null'
additionalProperties: true
required:
- status
- planId
- isTrialing
CheckoutSession:
type: object
properties:
checkoutUrl:
type: string
format: uri
sessionId:
type: string
required:
- checkoutUrl
- sessionId
VerifyCheckoutResult:
type: object
properties:
status:
type: string
example: trialing
trialEnd:
type:
- string
- 'null'
format: date-time
planId:
type: string
required:
- status
- planId
PortalSession:
type: object
properties:
portalUrl:
type: string
format: uri
required:
- portalUrl
PlanChangeResult:
type: object
properties:
currentPlanId:
type: string
pendingPlanId:
type: string
effectiveAt:
type: string
format: date-time
required:
- currentPlanId
- pendingPlanId
- effectiveAt
ErrorResponse:
type: object
properties:
success:
type: boolean
const: false
error:
type: string
message:
type: string
required:
- success
- error
- message
CreditSummary:
type: object
properties:
balance:
type: integer
monthlyAllocation:
type: integer
used:
type: integer
breakdown:
type: object
properties:
clips:
type: integer
aiGeneration:
type: integer
other:
type: integer
resetAt:
type: string
format: date-time
required:
- balance
- monthlyAllocation
- used
- breakdown
- resetAt
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-...`'