Layers Inc. Credits API

Organization credit balance + plan gates.

GitHub OpenAPI

Operations 2

GET /v1/credits Get organization credit balance + plan entitlements #
GET /v1/credits/events List credit ledger events #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • 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.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/layers-com:layers-com-credits-api"
All apis
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.

Get an API 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 Specification

layers-com-credits-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Layers Partner Credits API
  version: v1
  description: The Layers Partner API — one contract for programmatic access to projects, content generation, publishing, and webhooks. See https://layers.com/docs for conventions (auth, pagination, idempotency, errors). Auto-generated from the Zod schemas at `packages/shared-types/src/http/partner/**`; do not edit by hand.
  contact:
    name: Layers Partner Support
    url: https://layers.com/docs/api/operational/status-and-support
servers:
- url: https://api.layers.com
  description: Production
security:
- Bearer: []
tags:
- name: Credits
  description: Organization credit balance + plan gates.
paths:
  /v1/credits:
    get:
      summary: Get organization credit balance + plan entitlements
      operationId: getCredits
      tags:
      - Credits
      parameters: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerCreditsSchema'
        4XX:
          description: Client error (see operational/errors)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelopeSchema'
        5XX:
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelopeSchema'
  /v1/credits/events:
    get:
      summary: List credit ledger events
      operationId: listCreditEvents
      tags:
      - Credits
      parameters:
      - in: query
        name: cursor
        schema:
          description: Opaque cursor from a prior response's `nextCursor`; omit to start at the first page.
          type: string
          minLength: 1
          maxLength: 512
        description: Opaque cursor from a prior response's `nextCursor`; omit to start at the first page.
      - in: query
        name: limit
        schema:
          description: Maximum number of items to return per page (1–200).
          type: integer
          exclusiveMinimum: 0
          maximum: 200
        description: Maximum number of items to return per page (1–200).
      - in: query
        name: projectId
        schema:
          description: Filter events to a single project.
          $ref: '#/components/schemas/ProjectId'
        description: Filter events to a single project.
      - in: query
        name: eventType
        schema:
          description: Filter events to a single wallet-movement type.
          $ref: '#/components/schemas/CreditEventTypeEnum'
        description: Filter events to a single wallet-movement type.
      - in: query
        name: since
        schema:
          description: Return only events created at or after this time, ISO-8601 UTC.
          $ref: '#/components/schemas/IsoTimestampSchema'
        description: Return only events created at or after this time, ISO-8601 UTC.
      - in: query
        name: until
        schema:
          description: Return only events created at or before this time, ISO-8601 UTC.
          $ref: '#/components/schemas/IsoTimestampSchema'
        description: Return only events created at or before this time, ISO-8601 UTC.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditEventsResponseSchema'
        4XX:
          description: Client error (see operational/errors)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelopeSchema'
        5XX:
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelopeSchema'
components:
  schemas:
    ValidationIssueSchemaOutput:
      type: object
      properties:
        path:
          type: string
          description: Dotted path to the request field that failed validation.
        message:
          type: string
          description: Human-readable explanation of the validation failure.
      required:
      - path
      - message
      additionalProperties: false
    CreditEventsResponseSchema:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/CreditEventSchemaOutput'
        nextCursor:
          type:
          - string
          - 'null'
      required:
      - items
      additionalProperties: false
    CreditEventSchemaOutput:
      type: object
      properties:
        eventId:
          type: string
          description: Unique identifier for this ledger event.
        projectId:
          anyOf:
          - $ref: '#/components/schemas/ProjectId'
          - type: 'null'
          description: Project the event is attributed to, or null for org-level events like grants and purchases.
        credits:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Signed credit delta — negative for debits, positive for credits.
        eventType:
          description: Kind of wallet movement this event represents.
          $ref: '#/components/schemas/CreditEventTypeEnum'
        format:
          anyOf:
          - $ref: '#/components/schemas/ContentResponseFormatEnum'
          - type: 'null'
          description: Output format the charge was for, or null when the event isn't tied to generated content.
        containerId:
          anyOf:
          - $ref: '#/components/schemas/ContentContainerId'
          - type: 'null'
          description: Content item the charge produced, or null when not applicable.
        workflowId:
          description: Job identifier for cross-referencing with support, or null when not applicable.
          type:
          - string
          - 'null'
        balanceAfterPrepaid:
          anyOf:
          - type: integer
            minimum: -9007199254740991
            maximum: 9007199254740991
          - type: 'null'
          description: Prepaid balance after this event was applied, or null if it didn't touch prepaid.
        usageAfterPeriod:
          anyOf:
          - type: integer
            minimum: -9007199254740991
            maximum: 9007199254740991
          - type: 'null'
          description: Included-credits usage counter after this event, or null if it didn't touch the period counter.
        createdAt:
          description: When the event was recorded, ISO-8601 UTC.
          $ref: '#/components/schemas/IsoTimestampSchema'
        metadata:
          anyOf:
          - type: object
            propertyNames:
              type: string
            additionalProperties: {}
          - type: 'null'
          description: Reconciliation metadata for allocation transfers (transferId, direction, counterpartyOrgId, description, and your keys), or null for other event types.
      required:
      - eventId
      - projectId
      - credits
      - eventType
      - format
      - containerId
      - workflowId
      - balanceAfterPrepaid
      - usageAfterPeriod
      - createdAt
      - metadata
      additionalProperties: false
    OrganizationId:
      type: string
      minLength: 5
      maxLength: 64
      pattern: ^org_[A-Za-z0-9-]+$
    CreditEventTypeEnum:
      type: string
      enum:
      - usage
      - refund
      - grant
      - purchase
      - adjustment
      - allocation
      description: 'Kind of wallet movement: usage charge, refund, grant, prepaid purchase, admin adjustment, or sub-org allocation transfer.'
    ProjectId:
      type: string
      minLength: 5
      maxLength: 64
      pattern: ^prj_[A-Za-z0-9-]+$
    KillSwitchScopeEnum:
      type: string
      enum:
      - key
      - organization
      - global
      description: Breadth of the kill switch that blocked the request.
    PlatformErrorPlatformEnum:
      type: string
      enum:
      - tiktok
      - meta
      - apple
      - instagram
      - appstore
      description: Upstream platform that rejected or could not service the request.
    ErrorEnvelopeSchema:
      type: object
      properties:
        error:
          description: Error payload describing why the request failed.
          $ref: '#/components/schemas/ErrorBodySchemaOutput'
      required:
      - error
      additionalProperties: false
    ErrorDetailsSchemaOutput:
      type: object
      properties:
        reason:
          description: Short reason code or phrase narrowing the error.
          type: string
        originalRequestHash:
          description: Body hash of the original idempotent request, on a CONFLICT replay.
          type: string
        currentRequestHash:
          description: Body hash of the current request, on a CONFLICT replay.
          type: string
        issues:
          description: Per-field validation failures, present on VALIDATION errors.
          type: array
          items:
            $ref: '#/components/schemas/ValidationIssueSchemaOutput'
        requiredScope:
          description: Scope the API key lacks, present on FORBIDDEN_SCOPE errors.
          type: string
        scope:
          description: Breadth of the kill switch that tripped.
          $ref: '#/components/schemas/KillSwitchScopeEnum'
        resource:
          description: Exhausted billing resource, present on BILLING_EXHAUSTED errors.
          type: string
        platform:
          description: Platform whose stored credential is invalid.
          $ref: '#/components/schemas/PlatformErrorPlatformEnum'
        socialAccountId:
          description: Social account whose credential is invalid.
          type: string
        retryAfterSeconds:
          description: Seconds to wait before retrying.
          type: number
          minimum: 0
        retryAfterMs:
          description: Milliseconds to wait before retrying.
          anyOf:
          - type: number
            minimum: 0
          - type: 'null'
        platformCode:
          description: Raw error code returned by the upstream platform.
          type: string
        platformMessage:
          description: Raw error message returned by the upstream platform.
          type: string
        endpointClass:
          description: Rate-limit bucket the throttled request belongs to.
          type: string
        stage:
          description: Job stage at which the failure occurred.
          type: string
        flag:
          description: Moderation flag that blocked the request.
          type: string
        safetyCategory:
          description: Safety category triggered by moderation.
          type: string
        containerId:
          description: Content container the error relates to.
          type: string
        approvalStatus:
          description: Current approval status of the content.
          type: string
      additionalProperties: {}
    RequestId:
      type: string
      minLength: 5
      maxLength: 64
      pattern: ^req_[A-Za-z0-9-]+$
    IsoTimestampSchema:
      anyOf:
      - type: string
        format: date-time
        pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
      - type: string
        pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?:Z))$
      description: ISO-8601 UTC timestamp with the 'Z' suffix (e.g. `2026-04-18T12:04:11Z`). Offset forms like `+00:00` are rejected with 422 VALIDATION — convert to UTC before sending. Outputs always emit `Z` so input shape matches output shape.
    ContentContainerId:
      type: string
      minLength: 5
      maxLength: 64
      pattern: ^cnt_[A-Za-z0-9-]+$
    ErrorBodySchemaOutput:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/ErrorCodeEnum'
        message:
          type: string
          description: Human-readable description of the error.
        requestId:
          $ref: '#/components/schemas/RequestId'
        details:
          description: Code-specific structured context for the error.
          $ref: '#/components/schemas/ErrorDetailsSchemaOutput'
      required:
      - code
      - message
      - requestId
      additionalProperties: false
    ErrorCodeEnum:
      type: string
      enum:
      - UNAUTHENTICATED
      - FORBIDDEN_SCOPE
      - FORBIDDEN_FENCE
      - NOT_FOUND
      - CONFLICT
      - FEATURE_RETIRED
      - VALIDATION
      - APPROVAL_REQUIRED
      - CONTENT_REJECTED
      - RETURN_URL_NOT_ALLOWED
      - KILL_SWITCH
      - BILLING_EXHAUSTED
      - MODERATION_BLOCKED
      - CREDENTIAL_INVALID
      - CIRCUIT_OPEN
      - SOCIAL_ACCOUNT_NOT_PUBLISH_READY
      - APP_REVOKED
      - RATE_LIMITED
      - INTERNAL
      - PLATFORM_ERROR
      - UPLOAD_INCOMPLETE
      - UPLOAD_EXPIRED
      - PAYLOAD_TOO_LARGE
      - SCRAPE_FAILED
      - UPLOAD_QUOTA_EXCEEDED
      description: Stable machine-readable error code identifying what went wrong.
    PartnerCreditsSchema:
      type: object
      properties:
        organizationId:
          description: Organization the wallet belongs to.
          $ref: '#/components/schemas/OrganizationId'
        balance:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Total credits available — included credits remaining plus prepaid balance (gross, before reservations).
        available:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Credits spendable on new work right now — balance minus credits reserved for in-flight work, floored at 0.
        includedRemaining:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Credits remaining from your plan's monthly included allowance.
        prepaidBalance:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Prepaid credits purchased on top of your plan allowance.
        reservedCredits:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Credits committed to in-flight work and not yet spendable.
        includedThisPeriod:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Total included credits granted for the current billing period.
        usedThisPeriod:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Credits used so far in the current billing period.
        currentPeriod:
          anyOf:
          - type: object
            properties:
              start:
                anyOf:
                - type: string
                  format: date-time
                  pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                - type: 'null'
                description: Billing period start, ISO-8601 UTC, or null if no active period.
              end:
                anyOf:
                - type: string
                  format: date-time
                  pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                - type: 'null'
                description: Billing period end, ISO-8601 UTC, or null if no active period.
              usedCredits:
                type: integer
                minimum: -9007199254740991
                maximum: 9007199254740991
                description: Credits used within this billing period.
            required:
            - start
            - end
            - usedCredits
            additionalProperties: false
          - type: 'null'
          description: Current billing period window and usage, or null if no active period.
        subscriptionTier:
          anyOf:
          - type: string
            enum:
            - free
            - payg
            - starter
            - pro
            - ultra
            - scale
            - enterprise
          - type: 'null'
          description: 'Subscription plan tier, or null if no active plan. `payg` is pay as you go: $0 per month, no included credits, credits bought in packs. `scale` is the former name of `ultra` and appears only in historical records.'
        billingStatus:
          anyOf:
          - type: string
            enum:
            - active
            - paused
            - delinquent
            - canceled
            - trialing
          - type: 'null'
          description: Current billing status of the subscription, or null if no active plan.
        estimatedCreditsPerFormat:
          type: object
          properties:
            slideshow_builder:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
              description: Estimated upper-bound credit cost to generate one slideshow-builder content item.
            slideshow_remix:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
              description: Estimated upper-bound credit cost to generate one slideshow-remix content item.
            video_remix:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
              description: Estimated upper-bound credit cost to generate one video-remix content item.
            ugc_remix:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
              description: Estimated upper-bound credit cost to generate one UGC-remix content item.
            auto:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
              description: Estimated upper-bound credit cost when the format is chosen automatically.
          required:
          - slideshow_builder
          - slideshow_remix
          - video_remix
          - ugc_remix
          - auto
          additionalProperties: false
          description: Defensive upper-bound credit estimate per output format, for client-side pre-flight checks.
        ingestCostsBilled:
          type: object
          properties:
            github:
              type: boolean
              const: false
              description: Whether GitHub source ingestion is billed to your credits — always false.
            website:
              type: boolean
              const: false
              description: Whether website source ingestion is billed to your credits — always false.
            appstore:
              type: boolean
              const: false
              description: Whether App Store source ingestion is billed to your credits — always false.
          required:
          - github
          - website
          - appstore
          additionalProperties: false
          description: Which source-ingestion costs are billed to your credits today; all currently absorbed by Layers.
      required:
      - organizationId
      - balance
      - available
      - includedRemaining
      - prepaidBalance
      - reservedCredits
      - includedThisPeriod
      - usedThisPeriod
      - currentPeriod
      - subscriptionTier
      - billingStatus
      - estimatedCreditsPerFormat
      - ingestCostsBilled
      additionalProperties: false
    ContentResponseFormatEnum:
      type: string
      enum:
      - slideshow-builder
      - ugc-remix
      - video-remix
      - slideshow-remix
      - video_remix
      - slideshow_remix
      - ugc_remix
      - auto
      - video
      - slideshow
      - image_set
      description: Content format as stored on the item, including legacy values returned for older content.
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      description: 'Partner API key sent as `Authorization: Bearer <key>`. Issued per org; rotatable via the dashboard. This is the only accepted auth form.'