API Reference
Backoffice APIs
Sessile

Sessile API Reference

Overview

The Sessile API provides endpoints for managing token purchases and usage tracking in the TKM AI Agency Platform.

Base URL

/api/billing

Endpoints

Purchase Tokens

POST /purchase-tokens

Purchase additional token package.

Request Body

{
    "user_id": "string",
    "organization_id": "string",
    "package_id": "string",
    "payment_method": {
        "type": "string",
        "token": "string"
    }
}

Response

{
    "success": true,
    "transaction_id": "string",
    "package_details": {
        "id": "string",
        "tokens": "number",
        "expiry_date": "string"
    }
}

Get Usage Statistics

GET /usage/{user_id}

Get current usage statistics for a user.

Query Parameters

ParameterTypeRequiredDescription
organization_idstringYesOrganization identifier

Response

{
    "success": true,
    "usage": {
        "total_tokens": "number",
        "remaining_tokens": "number",
        "usage_by_agent": {},
        "period": "string"
    }
}

Stripe Webhook

POST /webhooks/stripe

Handle Stripe webhook events for payment processing.

Request Headers

  • stripe-signature: Stripe webhook signature

Request Body

Raw Stripe event payload

Response

{
    "status": "success"
}

Error Responses

400 Bad Request

{
    "detail": "Invalid Stripe webhook signature"
}

500 Internal Server Error

{
    "detail": "Sessile agent not configured" | "Error message"
}