Skip to main content
Contents

Billing and usage

Subscription, invoices, the open usage period and the payment method.

Examples marked as generated are built from the schema with synthetic values.

GET/api/v2/billing/subscription

Get the subscription

Returns the current subscription of the organization: plan, status, price and period.

Authentication
API token or portal session
Required permission
billing.read

Responses

  • 200OKapplication/json

    Fields (14)
    Responses getSubscription 200
    FieldTypeRequiredRules
    idstringYes
    • Pattern: ^sub_
    planobjectYes
    plan.codestringYes
    plan.namestringYes
    statusstringYes
    • One of: trialing, active, past_due, cancel_requested, cancelled, expired, legacy_unverified
    priceobjectYes
    price.amount_minorstringYes
    • Pattern: ^-?[0-9]+$
    price.currencystringYes
    • Pattern: ^[A-Z]{3}$
    interval_daysintegerYes
    included_bytesintegerYes
    • Format: int64
    sites_limitintegerYes
    • Can be null
    started_atstringYes
    • Format: date-time
    current_period_ends_atstringYes
    • Format: date-time
    • Can be null
    next_refresh_atstringYes
    • Format: date-time
    • Can be null
    Example (generated from the schema)
    {
      "id": "sub_",
      "plan": {
        "code": "string",
        "name": "Example"
      },
      "status": "trialing",
      "price": {
        "amount_minor": "0",
        "currency": "USD"
      },
      "interval_days": 1,
      "included_bytes": 1,
      "sites_limit": 1,
      "started_at": "2026-01-15T10:00:00Z",
      "current_period_ends_at": "2026-01-15T10:00:00Z",
      "next_refresh_at": "2026-01-15T10:00:00Z"
    }
  • 401Unauthorizedapplication/problem+json

    Headers: WWW-Authenticate

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/unauthenticated",
      "title": "Authentication required",
      "status": 401,
      "code": "unauthenticated",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 403Forbiddenapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/insufficient_scope",
      "title": "Insufficient permissions",
      "status": 403,
      "code": "insufficient_scope",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 404Not foundapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/not_found",
      "title": "Not found",
      "status": 404,
      "code": "not_found",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
curl
curl 'https://api.cdnify.lat/api/v2/billing/subscription' \
  -H "Authorization: Bearer $CDNIFY_API_TOKEN"
GET/api/v2/billing/invoices

List invoices

Returns the invoices of the organization, newest first.

Authentication
API token or portal session
Required permission
billing.read

Parameters

Parameters listInvoices
NameInTypeRequiredRules
limitQueryintegerNo
  • Minimum 1
  • Maximum 200
  • Default: 50
cursorQuerystringNo
  • At most 512 characters

Responses

  • 200OKapplication/json

    Fields (13)
    Responses listInvoices 200
    FieldTypeRequiredRules
    dataarray<object>Yes
    data[].idstringYes
    • Pattern: ^inv_
    data[].providerstringYes
    data[].referencestringYes
    data[].typestringYes
    • One of: subscription, one_time, unknown
    data[].statusstringYes
    • One of: draft, open, paid, void, refunded
    data[].amountobjectYes
    data[].amount.amount_minorstringYes
    • Pattern: ^-?[0-9]+$
    data[].amount.currencystringYes
    • Pattern: ^[A-Z]{3}$
    data[].issued_atstringYes
    • Format: date-time
    paginationobjectYes
    pagination.next_cursorstringYes
    • Can be null
    pagination.has_morebooleanYes
    Example (generated from the schema)
    {
      "data": [
        {
          "id": "inv_",
          "provider": "string",
          "reference": "string",
          "type": "subscription",
          "status": "draft",
          "amount": {
            "amount_minor": "0",
            "currency": "USD"
          },
          "issued_at": "2026-01-15T10:00:00Z"
        }
      ],
      "pagination": {
        "next_cursor": "string",
        "has_more": false
      }
    }
  • 400Bad requestapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/malformed_request",
      "title": "Malformed request",
      "status": 400,
      "code": "malformed_request",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 401Unauthorizedapplication/problem+json

    Headers: WWW-Authenticate

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/unauthenticated",
      "title": "Authentication required",
      "status": 401,
      "code": "unauthenticated",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 403Forbiddenapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/insufficient_scope",
      "title": "Insufficient permissions",
      "status": 403,
      "code": "insufficient_scope",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
curl
curl 'https://api.cdnify.lat/api/v2/billing/invoices' \
  -H "Authorization: Bearer $CDNIFY_API_TOKEN"
GET/api/v2/usage

Get usage

Returns the open usage period: bytes, requests, the limit and the active data blocks.

Authentication
API token or portal session
Required permission
billing.read

Responses

  • 200OKapplication/json

    Fields (13)
    Responses getUsage 200
    FieldTypeRequiredRules
    period_numberintegerYes
    starts_atstringYes
    • Format: date-time
    ends_atstringYes
    • Format: date-time
    • Can be null
    bytes_usedintegerYes
    • Format: int64
    bytes_limitintegerYes
    • Format: int64
    • Can be null
    requests_usedintegerYes
    • Format: int64
    metering_policystringYes
    • One of: actual_bytes, uncached_multiplier, legacy_x4
    metered_untilstringYes
    • Format: date-time
    • Can be null
    blocksarray<object>Yes
    blocks[].kindstringYes
    blocks[].bytes_limitintegerYes
    • Format: int64
    blocks[].bytes_usedintegerYes
    • Format: int64
    blocks[].expires_atstringYes
    • Format: date-time
    Example (generated from the schema)
    {
      "period_number": 1,
      "starts_at": "2026-01-15T10:00:00Z",
      "ends_at": "2026-01-15T10:00:00Z",
      "bytes_used": 1,
      "bytes_limit": 1,
      "requests_used": 1,
      "metering_policy": "actual_bytes",
      "metered_until": "2026-01-15T10:00:00Z",
      "blocks": [
        {
          "kind": "string",
          "bytes_limit": 1,
          "bytes_used": 1,
          "expires_at": "2026-01-15T10:00:00Z"
        }
      ]
    }
  • 401Unauthorizedapplication/problem+json

    Headers: WWW-Authenticate

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/unauthenticated",
      "title": "Authentication required",
      "status": 401,
      "code": "unauthenticated",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 403Forbiddenapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/insufficient_scope",
      "title": "Insufficient permissions",
      "status": 403,
      "code": "insufficient_scope",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 404Not foundapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/not_found",
      "title": "Not found",
      "status": 404,
      "code": "not_found",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
curl
curl 'https://api.cdnify.lat/api/v2/usage' \
  -H "Authorization: Bearer $CDNIFY_API_TOKEN"
POST/api/v2/billing/providers/{provider}/webhooks

Payment provider notifications

Receives the notifications of the payment provider, authenticated by its signature. It is not called by customers.

Authentication
None

Parameters

Parameters receiveProviderWebhook
NameInTypeRequiredRules
providerPathstringYes
  • One of: sandbox, cheddargetter

Request body

Content types: */*

Body: string

Example (generated from the schema)
…

Responses

  • 202Acceptedapplication/json

    Fields (2)
    Responses receiveProviderWebhook 202
    FieldTypeRequiredRules
    event_idstringYes
    • Format: uuid
    duplicatebooleanYes
    Example (generated from the schema)
    {
      "event_id": "00000000-0000-4000-8000-000000000000",
      "duplicate": false
    }
  • 400Bad requestapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/malformed_request",
      "title": "Malformed request",
      "status": 400,
      "code": "malformed_request",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 404Not foundapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/not_found",
      "title": "Not found",
      "status": 404,
      "code": "not_found",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 413Content too largeapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/payload_too_large",
      "title": "Request too large",
      "status": 413,
      "code": "payload_too_large",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 503Service unavailableapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/service_unavailable",
      "title": "Service unavailable",
      "status": 503,
      "code": "service_unavailable",
      "request_id": "req_01EXAMPLE00000000000000000"
    }

Called by a third party, not by customers. There is no curl example.

GET/api/v2/billing/payment-method

Get the payment method

Returns the details of the default payment method as the payment provider reports them. Card data is never returned.

Authentication
API token or portal session
Required permission
billing.read

Responses

  • 200OKapplication/json

    Fields (6)
    Responses getPaymentMethod 200
    FieldTypeRequiredRules
    providerstringYes
    kindstringYes
    • One of: card, paypal, other
    brandstringYes
    • Can be null
    last4stringYes
    • Pattern: ^[0-9]{4}$
    • Can be null
    expires_onstringYes
    • Can be null
    updated_atstringYes
    • Format: date-time
    Example (generated from the schema)
    {
      "provider": "string",
      "kind": "card",
      "brand": "string",
      "last4": "0123",
      "expires_on": "string",
      "updated_at": "2026-01-15T10:00:00Z"
    }
  • 401Unauthorizedapplication/problem+json

    Headers: WWW-Authenticate

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/unauthenticated",
      "title": "Authentication required",
      "status": 401,
      "code": "unauthenticated",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 403Forbiddenapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/insufficient_scope",
      "title": "Insufficient permissions",
      "status": 403,
      "code": "insufficient_scope",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 404Not foundapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/not_found",
      "title": "Not found",
      "status": 404,
      "code": "not_found",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 409Conflictapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/alias_in_use",
      "title": "Site name already in use",
      "status": 409,
      "code": "alias_in_use",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 422Unprocessable contentapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/validation_failed",
      "title": "Validation failed",
      "status": 422,
      "code": "validation_failed",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
curl
curl 'https://api.cdnify.lat/api/v2/billing/payment-method' \
  -H "Authorization: Bearer $CDNIFY_API_TOKEN"
POST/api/v2/billing/payment-method/update-session

Change the payment method

Returns a page of the payment provider where the payment method is changed. No charge is made.

Authentication
API token or portal session
Required permission
billing.manage

Responses

  • 201Createdapplication/json

    Headers: Cache-Control

    Fields (3)
    Responses createPaymentUpdateSession 201
    FieldTypeRequiredRules
    providerstringYes
    urlstringYes
    • Format: uri
    sandboxbooleanYes
    Example (generated from the schema)
    {
      "provider": "string",
      "url": "https://example.com/",
      "sandbox": false
    }
  • 401Unauthorizedapplication/problem+json

    Headers: WWW-Authenticate

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/unauthenticated",
      "title": "Authentication required",
      "status": 401,
      "code": "unauthenticated",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 403Forbiddenapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/insufficient_scope",
      "title": "Insufficient permissions",
      "status": 403,
      "code": "insufficient_scope",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 409Conflictapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/alias_in_use",
      "title": "Site name already in use",
      "status": 409,
      "code": "alias_in_use",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
  • 503Service unavailableapplication/problem+json

    Error codes:

    Problem details body
    Example
    {
      "type": "https://www.cdnify.lat/docs/errors/service_unavailable",
      "title": "Service unavailable",
      "status": 503,
      "code": "service_unavailable",
      "request_id": "req_01EXAMPLE00000000000000000"
    }
curl
curl -X POST 'https://api.cdnify.lat/api/v2/billing/payment-method/update-session' \
  -H "Authorization: Bearer $CDNIFY_API_TOKEN"