Skip to main content

API Reference

The Foil API provides programmatic access to traces, alerts, analytics, and more.

Base URL

For self-hosted deployments, use your instance URL.

Authentication

Foil supports two authentication methods:

JWT Bearer Token

For dashboard and user-authenticated requests:
Obtain a JWT token via the login endpoint:

API Key

For SDK and programmatic access:
API keys are created in the dashboard under Settings > API Keys.
API keys provide full access to your data. Keep them secure and never expose them in client-side code.

Rate Limits

Rate limit headers are included in responses:

Response Format

All responses are JSON with consistent structure:

Success Response

Error Response

Common Error Codes

Pagination

List endpoints support pagination:
Response includes pagination info:

Date Filtering

Most endpoints accept date filters:
Dates should be in ISO 8601 format: YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ

Core Endpoints

Users

Authentication

API Keys

Spans & Traces

Signals

Agents

Alerts

Analytics

Experiments

SDKs

For easier integration, use our official SDKs:

JavaScript SDK

npm install @getfoil/foil-js

Python SDK

pip install foil-sdk