Create an OpenFGA instance
const url = 'http://localhost:8000/clusters/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/openfga-instances';
const options = {
method: 'POST',
headers: {
'API-Version': '2026-06-01.beta',
'API-Key': '<API-Key>',
'Content-Type': 'application/json'
},
body: '{"realm":"my-service"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}curl --request POST \
--url http://localhost:8000/clusters/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/openfga-instances \
--header 'API-Key: <API-Key>' \
--header 'API-Version: 2026-06-01.beta' \
--header 'Content-Type: application/json' \
--data '{ "realm": "my-service" }'Creates an OpenFGA instance bound to one realm of the cluster. The instance starts in
provisioning.
Returns 403 when the workspace’s plan does not include OpenFGA or the workspace has
reached its instance limit, 409 when the realm already has an instance, and 422
when the realm is master, does not exist or is disabled.
Required scope: openfga:write
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
The realm to bind. It must exist and be enabled on the cluster, must not be master, and must not already have an instance.
Example
{
"realm": "my-service"
}Responses
Section titled “Responses”The instance was saved and is provisioning. Poll GET /clusters/{cluster_id}/openfga-instances/{instance_id} until status is ready or failed.
object
OpenFGA instance identifier.
The realm the instance is bound to. Chosen when the instance is created and never changed.
The reason the instance is failed.
Where the instance’s OpenFGA API answers.
The issuer the instance trusts. Only tokens from this issuer are accepted.
The audience a token must carry. Add an audience mapper for this value to the realm’s client.
Example
{
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"cluster_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"realm": "my-service",
"status": "ready",
"api_url": "https://openfga-7c9e6679.eu.skycloak.io",
"issuer": "https://auth.example.com/realms/my-service",
"audience": "https://openfga-7c9e6679.eu.skycloak.io",
"created_at": "2026-11-05T10:00:00Z",
"updated_at": "2026-11-05T10:02:10Z"
}Headers
Section titled “Headers”URL of the resource being created or modified. Poll this endpoint to track completion.
Access is unauthorized.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Access is forbidden.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}The server cannot find the requested resource.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}The request conflicts with the current state of the server.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Client error
object
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com",
"errors": [
{
"field": "example",
"detail": "example",
"code": "example",
"value": "example"
}
]
}Client error
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Headers
Section titled “Headers”Server error
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Server error
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}