OpenFGA
OpenFGA is a CNCF project for fine-grained, relationship-based access control (ReBAC) inspired by Google's Zanzibar paper. An authorization model, written in the OpenFGA DSL or JSON, defines types and relations; relationship tuples stored in a store say who is related to what; the API answers "does user U have relation R with object O?". This skill produces models, tuples, .fga.yaml tests and API calls that the OpenFGA language tooling and server accept.
Follow the workflow below step by step. Every rule here comes from a source in Sources. OpenFGA pages have no section numbers, so rules cite the page and heading name; grammar and API rules cite the file and the rule, message or field name. When a rule and the pinned source disagree, the source wins; when the source has a newer revision than the pin, follow the refresh steps.
Inputs (fill in, or ask before starting)
- Role: model author, model reviewer, or application integrator calling the API (writing tuples and running queries).
- Target version: OpenFGA schema 1.1 (current, the default for a single-file model). OpenFGA schema 1.2 (modular models) is the current line of the modular family: use it when the model is split into modules with an
fga.mod. OpenFGA schema 1.0 is legacy: read it and upgrade from it, never author it. The server and API target is OpenFGA server v1.21 (current). Seereferences/versions.md. - Revision: the pinned revision in Sources, unless the user names another.
- Requirements: the feature to model in plain language ("a user can share a document if they are its owner or an editor"), the object types, and which checks the application will make.
- Runtime data: attributes only known at request time (time, IP address, token claims), which decide between conditions and contextual tuples.
- Sources: when refreshing this skill or when a rule looks out of date, re-read every URL in Sources first, check
openfga/openfgareleases and theopenfga/languagegrammar for a newer server release or schema version, and update the pins.
Invariants
- Every model starts with a schema header. A single-file DSL model begins
modelthenschema 1.1; a module file beginsmodule <name>instead (OpenFGAParser.g4,modelHeaderandmoduleHeader). The API'sschema_versionis required and must be1.0,1.1or1.2(openfga_service.proto,WriteAuthorizationModelRequest.schema_version). - Direct assignment needs type restrictions. A relation accepts tuples only if its definition starts with
[...]; each entry istype,type:*ortype#relation, optionallywith <condition>. Without them, direct relationships are disallowed (Configuration Language, Direct Relationship Type Restrictions). - A tupleset is a plain, concrete relation. In
X from Y,Ymust be a relation on the same type that is directly assignable, not a rewrite, and whose type restrictions contain notype:*and notype#relation; otherwiseWriteAuthorizationModelfails validation (Configuration Language, Referencing Relations On Related Objects; validate-dsl.ts,TupleToUserset). type:*is not a wildcard. It means every object of that type and is valid only in a tuple'suserfield, never inobject, never inrelation, and never inside a userset such asorg:*#member(Concepts, What Is Type Bound Public Access; Public Access).- Every relation needs an entry point. A relation that can never be satisfied by a tuple (for example one that only references itself) is rejected (validate-dsl.ts,
raiseNoEntryPointandraiseNoEntryPointLoop). - Names follow the rules. Relations use alphanumerics,
_and-;selfandthisare reserved type and relation names; type names are at most 254 characters and relation names at most 50 (Get Started with Modeling, 03; validate-dsl.ts; openfga.protoTupleKey). - Conditions are declared, typed and used. A condition has typed parameters and a CEL expression of at most 512 bytes; a model has at most 25 conditions; an unused condition is a validation error; a tuple for a
withrestriction must carry that condition (Conditions; authzmodel.protoCondition; validate-dsl.tsraiseUnusedCondition). - Models are immutable; pin the id. Every write creates a new
authorization_model_id; omitting it makes the server use the latest model. Pass it on Check, ListObjects, ListUsers, Expand and Write in production (Immutable Authorization Models; Managing Tuples and Invoking API Best Practices). - Write is transactional and bounded. One Write holds at most 100 unique tuples across writes and deletes, all succeed or fail together, and a tuple cannot appear twice in one request (Update Relationship Tuples, 04).
- No personal data in identifiers. Do not put personal or regulated data in user or object ids (Managing Tuples and Invoking API Best Practices).
- Test before deploying. Every model is tested with a
.fga.yamlfile covering every relation the application will query (Testing Models).
Workflow
- Pick the version. Target schema 1.1 for a single file, schema 1.2 when the model is split into modules, and server v1.21 for API behaviour.
->
references/versions.md✓ The target schema and server line are recorded, and neither is legacy. - Write the requirements as relations. Start from the objects, phrase each permission as "a user can {action} a {type} if …", list the types (groups and containers first), and name permissions
can_{action}. ->references/modeling-language.md✓ Every application check maps to onetype#relation. - Define the relations. Use type restrictions for assignable relations,
or/and/but notfor set logic,X from Yfor hierarchies, and keep permissions non-assignable. ->references/modeling-language.md,references/testing-and-patterns.md✓ The model parses and validates: every tupleset is concrete, every relation has an entry point. - Add conditions or contextual tuples for runtime data. Use a condition for attributes compared at request time, and contextual tuples for relationships known only for one request.
->
references/conditions-and-modules.md✓ Every condition is used, its parameters are typed, and every check that hits it supplies the request context. - Split into modules if several teams own the model. Write
fga.modwithschema: '1.2', onemoduleper file, andextend typefor relations added to another module's type. ->references/conditions-and-modules.md✓fga model write --file fga.modsucceeds and no relation is defined twice. - Test the model. Write
.fga.yamlwith tuples andcheck,list_objectsandlist_usersassertions, positive and negative, and runfga model test. ->references/testing-and-patterns.md✓fga model test --tests <file>.fga.yamlreports every test passing. - Integrate the API. Write tuples with Write, answer access with Check or BatchCheck, filter with ListObjects, list subjects with ListUsers, and debug with Expand; pin the model id and choose consistency per request.
->
references/tuples-and-api.md✓ Each call passesauthorization_model_id, andHIGHER_CONSISTENCYis used only where a just-written tuple must be seen. - Upgrade (only when asked). Upgrade a schema 1.0 model to 1.1, a single file to modules, or a model change through a migration with a new model id.
->
references/versions.md✓ The upgraded model passes the same.fga.yamltests as before, plus tests for the change.
Verify before done
- The model has a
model/schema 1.1header (ormodulefiles plusfga.modwithschema: '1.2') and no schema 1.0 constructs. - Every relation the application writes tuples for has type restrictions; every
can_*permission has none. - No tupleset in
X from Yhas a rewrite,type:*ortype#relationin its type restrictions. - No tuple has
type:*inobject, ortype:*#relationasuser. - Every condition is referenced by a
withrestriction, and tests pass a context that makes it both true and false. -
.fga.yamlcovers every relation with at least onetrueand onefalseassertion, andfga model testpasses. - API calls pass
authorization_model_id; writes stay at or under 100 tuples; contextual tuples stay at or under 100. - No identifier contains personal data.
Reference index
references/versions.md: schema 1.0, 1.1 and 1.2 and the server line, what changed, upgrade steps (1.0 to 1.1, single file to modules, model migrations), and experimental server features. Load for steps 1 and 8.references/modeling-language.md: the DSL grammar, types, relations, type restrictions, usersets, type-bound public access, the operators,from, nesting, the JSON mapping, naming and validation errors. Load for steps 2 and 3.references/conditions-and-modules.md: conditions, parameter types, CEL limits, conditional tuples and context merging, contextual tuples, modules,fga.modandextend type. Load for steps 4 and 5.references/tuples-and-api.md: tuple format and limits, Write semantics, Check, BatchCheck, ListObjects, StreamedListObjects, ListUsers, Read, Expand, ReadChanges, model ids and consistency. Load for step 7.references/testing-and-patterns.md: the.fga.yamlstore file, test assertions, the CLI and CI action, and the patterns for roles, groups, hierarchies, public access, multiple restrictions, custom roles and blocklists. Load for steps 3 and 6.
Related skills
authzen, for the AuthZEN Authorization API that OpenFGA supports experimentally:npx skills add ScaleDockHQ/scaledock-skills --skill authzencel, for the Common Expression Language used in condition expressions:npx skills add ScaleDockHQ/scaledock-skills --skill celrego, for policy-as-code with Open Policy Agent instead of relationship tuples:npx skills add ScaleDockHQ/scaledock-skills --skill regocedar, for the Cedar policy language as another way to express authorization:npx skills add ScaleDockHQ/scaledock-skills --skill cedar
Sources
Status uses the publishing body's own maturity term. Checked is the date the source was last read.
- OpenFGA Configuration Language: Documentation, openfga.dev main at fb53597 (2026-09-29), checked 2026-10-05.
- OpenFGA Concepts: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- OpenFGA Modeling Guides: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Get Started with Modeling: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Conditions: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Modular Models: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Testing Models: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Store File Format: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Modeling patterns: User Groups, Roles and Permissions, Parent-Child Objects, Public Access, Multiple Restrictions, Custom Roles, Blocklists and Usersets: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Model Migrations: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Relationship Queries: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Contextual Tuples: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Query Consistency Modes: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Update Relationship Tuples: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Immutable Authorization Models: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- Managing Tuples and Invoking API Best Practices: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- OpenFGA CLI: Documentation, openfga.dev main at fb53597, checked 2026-10-05.
- OpenFGA API: API reference rendered from
openfga/api, checked 2026-10-05. - openfga/api: openfga_service.proto, openfga.proto, authzmodel.proto and openfga_service_consistency.proto: API definition, main at c0650ce (2026-09-28), checked 2026-10-05.
- openfga/language: OpenFGAParser.g4 and OpenFGALexer.g4: ANTLR grammar, main at f558baa (2026-10-01), checked 2026-10-05.
- openfga/language: README, validate-dsl.ts, schema_version.ts, mod-to-json.go and module-to-model.go: Language tooling, main at f558baa, checked 2026-10-05.
- openfga/language release pkg/go/v0.3.2: Released, 2026-10-01, checked 2026-10-05.
- OpenFGA v1.21.0: Released, 2026-09-20 (latest), checked 2026-10-05.
- OpenFGA CHANGELOG: Changelog, through v1.21.0 and Unreleased, checked 2026-10-05.
- openfga/openfga PR #3313: dynamic conditions (experimental): Merged 2026-09-20, experimental flag
inline_expressions, checked 2026-10-05.