POST
/
v1
/
tenants
/
{tenant_id}
/
schemas
/
write
sr, err: = client.Schema.Write(context.Background(), &v1.SchemaWriteRequest {
    TenantId: "t1",
    Schema: `
    "entity user {}\n\n    entity organization {\n\n        relation admin @user\n        relation member @user\n\n        action create_repository = (admin or member)\n        action delete = admin\n    }\n\n    entity repository {\n\n        relation owner @user\n        relation parent @organization\n\n        action push = owner\n        action read = (owner and (parent.admin and parent.member))\n        action delete = (parent.member and (parent.admin or owner))\n    }"
    `,
})
{
  "schema_version": "<string>"
}

Permify provide it’s own authorization language to model common patterns of easily. We called the authorization model Permify Schema and it can be created on our playground as well as in any IDE or text editor.

We also have a VS Code extension to ease modeling Permify Schema with code snippets and syntax highlights. Note that on VS code the file with extension is “.perm”.

If you’re planning to test Permify manually, maybe with an API Design platform such as Postman, Insomnia, etc; we’re suggesting using our playground to create model. Because Permify Schema needs to be configured (send to API) in Permify API in a string format. Therefore, created model should be converted to string.

Although, it could easily be done programmatically, it could be little challenging to do it manually. To help on that, we have a button on the playground to copy created model to the clipboard as a string, so you get your model in string format easily.

copy-btn

Permify Schema needed to be send to API endpoint /v1/schemas/write” for configuration of your authorization model on Permify API.

Example Request on Postman

POST /v1/tenants/{tenant_id}/schemas/write

permify-schema

See the following FAQ page to refer to the suggested workflow for: Managing Schema Changes.

Path Parameters

tenant_id
string
required

Identifier of the tenant, if you are not using multi-tenancy (have only one tenant) use pre-inserted tenant <code>t1</code> for this field. Required, and must match the pattern \“[a-zA-Z0-9-,]+\“, max 64 bytes.

Body

application/json
schema
string

schema is the string representation of the schema to be written.

Response

200 - application/json
schema_version
string

schema_version is the string that identifies the version of the written schema.