Skip to main content

TfCode & API Integration

ToothFairyAI provides a comprehensive API that allows you to integrate AI capabilities directly into your applications and workflows.

Getting Started​

Finding Your Credentials​

You can find your Workspace ID and API Key in the ToothFairyAI dashboard under Admin → TFCode & API Integration.

Key Management​

Workspace administrators have the ability to rotate (regenerate) API keys at any time. This is recommended for:

  • Security best practices
  • Responding to potential key compromises
  • Onboarding/offboarding team members

To rotate your API key:

  1. Navigate to Admin → TFCode & API Integration
  2. Click Rotate API Key
  3. Confirm the action
warning

Rotating your API key immediately invalidates the previous key. Update any applications or integrations using the old key to avoid service interruptions.

Subscription Access
  • TF Code is available to all paid users.
  • API Integration (external programmatic API access) is available only on paid plans.

Authentication​

All API requests require authentication using:

  • API Key: Found in Admin → TFCode & API Integration
  • Workspace ID: Found in Admin → TFCode & API Integration

Include these in your request headers:

x-api-key: your-api-key

And in your request body:

{
"workspaceid": "your-workspace-id"
}

API Endpoints​

ToothFairyAI provides three types of API endpoints, each available in multiple regions:

Platform Management (api.*)​

Used for workspace and platform management operations.

DomainRegionAccess
api.toothfairyai.comAustraliaAll paid plans
api.eu.toothfairyai.comEuropeAll paid plans
api.us.toothfairyai.comUnited StatesAll paid plans

REST API (ai.*)​

Standard REST endpoints for AI services with request/response pattern.

DomainRegionAccess
ai.toothfairyai.comAustraliaAll subscriptions
ai.eu.toothfairyai.comEuropeAll subscriptions
ai.us.toothfairyai.comUnited StatesAll subscriptions

Streaming & Voice (ais.*)​

Server-Sent Events (SSE) and Voice endpoints for real-time streaming responses.

DomainRegionAccess
ais.toothfairyai.comAustraliaAll subscriptions
ais.eu.toothfairyai.comEuropeAll subscriptions
ais.us.toothfairyai.comUnited StatesAll subscriptions
tip

Choose the regional endpoint closest to your users or based on your data residency requirements. All regional endpoints share the same quotas and functionality.

For complete endpoint documentation, visit the API Reference.

Regions & data residency​

ToothFairyAI runs the platform on its own servers in three regions — Australia (AU), Europe (EU) and the United States (US). A workspace is created in one region and its platform data, agents, Knowledge Hub documents and conversation history are stored and processed there.

This is not a gateway or an aggregator: your requests are not resold or forwarded to a third-party router that picks a provider on your behalf. The platform, the agents, document storage and serverless model inference are served by ToothFairyAI-operated infrastructure in the region you chose.

Scope of the guarantee

A small number of models are marked on-demand or external in /models_list. Those are served directly by upstream providers and are not hosted on ToothFairyAI infrastructure — see Models & Regions. Serverless models and the rest of the platform are.

Global vs Regional routing​

Data residency depends on the routing mode you select:

ModeWhere requests are processedResidency guarantee
Global (default)Your preferred region, but may route to EU and/or US when local capacity drops below 50%No — traffic may cross regions
RegionalYour selected region only; requests queue if capacity is unavailableYes — data never leaves the region

If you need a contractual data-residency guarantee, use Regional mode, or have a workspace admin enforce regional inference for all agents. Global keeps your traffic on ToothFairyAI-operated infrastructure, but it is allowed to use another region for availability — so it is not a residency guarantee.

Compliance​

Regional isolation supports regional data-protection obligations — GDPR in the EU, the Australian Privacy Principles in AU, and US data-protection standards. The Account page covers how the region is chosen at sign-up and why it is permanent for the lifetime of the workspace.

tip

Use the endpoint for your workspace's region — api.*, ai.* and ais.* each have AU, EU and US variants. A workspace's data is held in one region and does not replicate to the others, so point each integration at the region where the workspace was created.

Usage & Limits​

ToothFairyAI is a pure PaaS product — there is no fixed monthly subscription. You buy intelligence credits upfront and are billed for the UoI (Units of Intelligence) you actually consume. Credits never expire, so you only ever pay for what you use.

API Access​

External API access is available to all paid users.

SubscriptionExternal API Access
ServerlessFull API access
EnterpriseFull API access

Intelligence Credits​

Your AI usage is measured in UoI (Units of Intelligence) at 1 UoI = $0.01 USD. You pre-purchase intelligence credits, and UoI is debited from your credit balance as your agents run.

SubscriptionHow you payCredits expiry
ServerlessPay as you go — buy credits upfront, billed for UoI consumedCredits never expire
EnterpriseCustom annual commitment with reserved UoIArranged with your account team
How it works
  • Serverless is consumption-based: top up your credit balance at any time. There is no fixed monthly minimum or maximum — you simply consume UoI as you go, and unused credits carry over indefinitely.
  • Enterprise customers can request custom UoI allocations and reserved compute tailored to their specific needs.

Rate Limits​

To ensure optimal performance for all users, AI requests are subject to rate limits based on a 30-minute rolling window. Rate limits scale with your workspace and can be increased for Enterprise customers with custom allocations. Contact support if you need higher limits for production workloads.

What counts towards usage?​

Your intelligence budget is consumed based on the AI processing required for each request. Different operations have different costs based on complexity:

  • Chat & Agent interactions - Based on conversation length and complexity
  • Content generation - Based on output length
  • Document processing - Based on document size
  • Search & retrieval - Minimal cost per query

You can monitor your current usage and remaining credit balance in real-time from your workspace dashboard.

Available Services​

ToothFairyAI services are organised into three main categories:

CategoryEndpointsDescription
Platform Managementapi.*Workspace configuration, agents creation, user management, and platform administration
AI Agentsai.*Interact with AI agents for tasks, plans, search, and agentic use cases
Voice Agentsais.*Real-time voice interactions with AI agents using streaming

For complete endpoint documentation, request/response formats, and usage examples, visit the API Reference.

Error Handling​

Common Error Responses​

Status CodeDescriptionSolution
400Bad RequestCheck your request body and ensure all required fields are included
401UnauthorizedVerify your API key and workspace ID are correct
404Not FoundCheck the endpoint path is correct
500Server ErrorRetry the request; contact support if persistent

Credit Balance Exhausted​

When your workspace has used up its intelligence credit balance:

{
"errorMessage": "The organisation has exhausted its intelligence credit balance. Please top up your credits to continue."
}

What to do:

  • Check your current usage in the workspace dashboard
  • Top up your intelligence credits — credits never expire, so any unused balance remains available
  • Contact support if you need higher allocations

Rate Limit Exceeded​

When you've made too many requests in a short period:

{
"errorMessage": "Too many requests in the last 30 minutes. Please try again in a few minutes or upgrade your plan"
}

What to do:

  • Wait a few minutes before retrying
  • Implement exponential backoff in your application
  • Consider upgrading for higher rate limits

API Access Denied​

If your subscription doesn't include external API access:

{
"errorMessage": "API access not allowed for this subscription type"
}

What to do:

  • Upgrade to a paid plan for full API access
  • Use the ToothFairyAI application or TF Code for AI features without external API access

CLI, SDK & MCP​

ToothFairyAI provides multiple tools for developers to integrate AI capabilities into their workflows.

Command Line Tools & SDKs​

For command-line access and programmatic integration, visit the Downloads page for:

  • Python CLI & SDK: Install with pip install toothfairy-cli
  • Node.js CLI & SDK: Install with npm install @toothfairyai/cli

These tools provide command-line access to ToothFairyAI's features for automation, scripting, and integration into development workflows.

Model Context Protocol (MCP)​

ToothFairyAI supports the Model Context Protocol for seamless integration with AI assistants and IDE extensions.

The MCP server uses Server-Sent Events (SSE) for real-time communication and can be configured in compatible AI tools and IDEs.

Monitoring Usage​

Track your intelligence credit consumption in real-time from your workspace dashboard:

  1. Navigate to Dashboard to view current usage
  2. Enable alerts in Settings > Other Settings > Notifications
  3. Receive notifications when approaching 80% and 100% of your credit balance
Credit Balance

When your intelligence credit balance is exhausted, API requests will be rejected until you top up your credits. Credits never expire, so there is no monthly reset — any unused balance remains available.