T Backend Developer Guide

agentT_realistic

Welcome to T Backend! This guide helps you integrate with the T API and understand the core request flows.


Authentication

API Key

All authenticated requests use an api-key header:

curl -s https://api-v2.fluxpointstudios.com/health \
  -H "api-key: YOUR_API_KEY_HERE"

If you need an API key, contact [email protected] or reach out on Discordarrow-up-right.

Pay‑Per‑Call (x402)

If you omit api-key on protected endpoints, the server may return:

  • 402 Payment Required with an invoice payload

  • You pay the invoice on-chain

  • You retry the same request with:

    • X-Invoice-Id: <invoiceId>

    • X-Payment: <tx_hash_or_signed_cbor>

Partner billing (recommended): include X-Partner: <partner_name> and X-Wallet-Address: <addr...> so your pricing/tier rules apply.


Public API Surface

The customer-facing Swagger docs are intentionally scoped to:

  • GET /health, GET /api

  • POST /chat

  • POST /token-analysis

  • POST /images/*

  • GET/POST /payments/* (when payments are enabled)

If you have additional capabilities enabled for your deployment, you’ll receive separate documentation for those routes.


1) Chat (POST /chat)

Send a message and receive a reply. Use session_id to preserve context across turns.

Basic example

Structured output (optional)

If you want a JSON object back (when the assistant returns JSON), set output=structured (query param) or output_mode="structured" (body):

Streaming (Server‑Sent Events)

Set "stream": true to stream tokens as SSE (client must support SSE):

Image input (optional)

Provide image_data as a base64 data URI:


2) Token Analysis (POST /token-analysis)

Analyze a token by ticker and policy id (Cardano).

Notes:

  • The endpoint may cache results for performance.

  • You can bypass cache using x-bypass-cache: 1.


3) Images (/images/*)

Generate (POST /images/generate)

Edit (POST /images/edit)

  • input_images is a list of base64 images

  • Each image is validated to <= 25MB

Upload + edit (POST /images/upload-and-edit)

Use this if you want to upload an image file directly instead of base64. Refer to Swagger docs for the exact multipart form fields.

Variations (POST /images/variations)

This endpoint is API-key only (not pay-per-call). Refer to Swagger docs for the request format.


Payments & Access Control (x402)

What a 402 invoice looks like

When payment is required, you’ll get HTTP 402 with a body like:

Key fields:

  • payTo: destination address

  • amountUnits + decimals: what to pay

  • asset + chain: network/asset label

Revenue share / split outputs (optional)

If your partner tier has revenue share enabled, the invoice may include detail.extra.outputs / detail.extra.split.

In that case, your payment transaction must include those outputs; the verifier enforces them.

Paying + retrying

After you pay, retry the original request with:

  • X-Invoice-Id: <invoiceId>

  • X-Payment: <tx_hash_or_signed_cbor>

Example (retrying /chat):

Payment helpers

  • Poll invoice status:

  • Check prepaid balance (ADA partners):


Operational Notes

Request IDs

You may send X-Request-Id and the server will echo X-Request-ID back on responses. This helps correlate logs and support requests.

Common status codes

  • 401: missing/invalid api-key

  • 402: payment required (x402 invoice returned)

  • 403: forbidden (insufficient privileges)

  • 413: payload too large (commonly for image base64 uploads)

  • 422: invalid request body

  • 5xx: transient server or upstream failures; retry with backoff


Troubleshooting

1) “401 Unauthorized”

  • Ensure api-key header is present and correct.

  • Confirm the key is active (contact support if unsure).

2) “402 Payment Required”

  • Read the invoiceId, asset, amountUnits, decimals, and payTo.

  • Pay on-chain.

  • Retry with X-Invoice-Id + X-Payment.

3) “wallet_address_required_for_prepaid_batches”

  • Some partner billing modes require X-Wallet-Address so prepaid balance can be tracked.

Debug tip


Additional Resources


You’re Ready

Quick checklist:

Last updated