ForjinnForjinn
API Reference

Authenticate Requests to the Forjinn API

Learn how to authenticate requests to the Forjinn API using API keys via the Authorization header or a query parameter, plus notes on public chatflows.

The Forjinn API authenticates requests using API keys. Every key is scoped to your workspace and can be created from Settings → API Keys in the Forjinn dashboard. Keep your keys secure — treat them like passwords and never expose them in client-side code or public repositories.

Obtaining an API key

Go to Settings → API Keys in your Forjinn instance to generate a key. You'll receive a key string you can use immediately.

Authentication methods

Include your key as a Bearer token in the Authorization header:

Authorization: Bearer <your-api-key>
curl -X GET https://your-forjinn-instance.com/api/v1/chatflows \
  -H "Authorization: Bearer fj-abc123def456"
const response = await fetch('https://your-forjinn-instance.com/api/v1/chatflows', {
  headers: {
    'Authorization': 'Bearer fj-abc123def456',
    'Content-Type': 'application/json',
  },
});

const chatflows = await response.json();

Query parameter

Pass the key as the apiKey query parameter. This is useful for quick tests or environments where setting custom headers is not straightforward:

GET /api/v1/chatflows?apiKey=fj-abc123def456

Avoid the query-parameter method in production. URLs are often logged by servers, proxies, and browser history, which can expose your key.

curl "https://your-forjinn-instance.com/api/v1/chatflows?apiKey=fj-abc123def456"
const key = 'fj-abc123def456';
const response = await fetch(
  `https://your-forjinn-instance.com/api/v1/chatflows?apiKey=${key}`
);

const chatflows = await response.json();

Public chatflows

Chatflows marked as public (isPublic: true) accept prediction requests without an API key. This is useful for embedding a chatbot on a public website. All other endpoints still require authentication.

When calling POST /api/v1/prediction/:id for a public chatflow you can omit the Authorization header entirely.

Error responses

StatusCause
401 UnauthorizedNo API key was provided, or the key is invalid
403 ForbiddenThe key is valid but does not have permission to access this resource

A 401 response body looks like:

{
  "message": "Unauthorized"
}

If you receive a 403, verify that the key belongs to a workspace that has access to the resource you are requesting.

On this page