{ "consumes": ["application/json"], "produces": ["application/json"], "schemes": ["http", "https"], "swagger": "2.0", "info": { "description": "Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.", "title": "ORY Keto", "contact": { "name": "ORY", "url": "https://www.ory.sh", "email": "hi@ory.sh" }, "license": { "name": "Apache 2.0", "url": "https://github.com/ory/keto/blob/master/LICENSE" }, "version": "Latest" }, "basePath": "/", "paths": { "/admin/relation-tuples": { "put": { "description": "Use this endpoint to create a relation tuple.", "consumes": ["application/json"], "produces": ["application/json"], "schemes": ["http", "https"], "tags": ["write"], "summary": "Create a Relation Tuple", "operationId": "createRelationTuple", "parameters": [ { "name": "Payload", "in": "body", "schema": { "$ref": "#/definitions/RelationQuery" } } ], "responses": { "201": { "description": "RelationQuery", "schema": { "$ref": "#/definitions/RelationQuery" } }, "400": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } }, "500": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } } } }, "delete": { "description": "Use this endpoint to delete relation tuples", "consumes": ["application/x-www-form-urlencoded"], "produces": ["application/json"], "schemes": ["http", "https"], "tags": ["write"], "summary": "Delete Relation Tuples", "operationId": "deleteRelationTuples", "parameters": [ { "type": "string", "description": "Namespace of the Relation Tuple", "name": "namespace", "in": "query" }, { "type": "string", "description": "Object of the Relation Tuple", "name": "object", "in": "query" }, { "type": "string", "description": "Relation of the Relation Tuple", "name": "relation", "in": "query" }, { "type": "string", "description": "SubjectID of the Relation Tuple", "name": "subject_id", "in": "query" }, { "type": "string", "description": "Namespace of the Subject Set", "name": "subject_set.namespace", "in": "query" }, { "type": "string", "description": "Object of the Subject Set", "name": "subject_set.object", "in": "query" }, { "type": "string", "description": "Relation of the Subject Set", "name": "subject_set.relation", "in": "query" } ], "responses": { "204": { "$ref": "#/responses/emptyResponse" }, "400": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } }, "500": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } } } }, "patch": { "description": "Use this endpoint to patch one or more relation tuples.", "consumes": ["application/json"], "produces": ["application/json"], "schemes": ["http", "https"], "tags": ["write"], "summary": "Patch Multiple Relation Tuples", "operationId": "patchRelationTuples", "parameters": [ { "name": "Payload", "in": "body", "schema": { "type": "array", "items": { "$ref": "#/definitions/PatchDelta" } } } ], "responses": { "204": { "$ref": "#/responses/emptyResponse" }, "400": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } }, "404": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } }, "500": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } } } } }, "/health/alive": { "get": { "description": "This endpoint returns a 200 status code when the HTTP server is up running.\nThis status does currently not include checks whether the database connection is working.\n\nIf the service supports TLS Edge Termination, this endpoint does not require the\n`X-Forwarded-Proto` header to be set.\n\nBe aware that if you are running multiple nodes of this service, the health status will never\nrefer to the cluster state, only to a single instance.", "produces": ["application/json"], "tags": ["health"], "summary": "Check alive status", "operationId": "isInstanceAlive", "responses": { "200": { "description": "healthStatus", "schema": { "$ref": "#/definitions/healthStatus" } }, "500": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } } } } }, "/health/ready": { "get": { "description": "This endpoint returns a 200 status code when the HTTP server is up running and the environment dependencies (e.g.\nthe database) are responsive as well.\n\nIf the service supports TLS Edge Termination, this endpoint does not require the\n`X-Forwarded-Proto` header to be set.\n\nBe aware that if you are running multiple nodes of this service, the health status will never\nrefer to the cluster state, only to a single instance.", "produces": ["application/json"], "tags": ["health"], "summary": "Check readiness status", "operationId": "isInstanceReady", "responses": { "200": { "description": "healthStatus", "schema": { "$ref": "#/definitions/healthStatus" } }, "503": { "description": "healthNotReadyStatus", "schema": { "$ref": "#/definitions/healthNotReadyStatus" } } } } }, "/relation-tuples": { "get": { "description": "Get all relation tuples that match the query. Only the namespace field is required.", "consumes": ["application/x-www-form-urlencoded"], "produces": ["application/json"], "schemes": ["http", "https"], "tags": ["read"], "summary": "Query relation tuples", "operationId": "getRelationTuples", "parameters": [ { "type": "string", "name": "page_token", "in": "query" }, { "type": "integer", "format": "int64", "name": "page_size", "in": "query" }, { "type": "string", "description": "Namespace of the Relation Tuple", "name": "namespace", "in": "query" }, { "type": "string", "description": "Object of the Relation Tuple", "name": "object", "in": "query" }, { "type": "string", "description": "Relation of the Relation Tuple", "name": "relation", "in": "query" }, { "type": "string", "description": "SubjectID of the Relation Tuple", "name": "subject_id", "in": "query" }, { "type": "string", "description": "Namespace of the Subject Set", "name": "subject_set.namespace", "in": "query" }, { "type": "string", "description": "Object of the Subject Set", "name": "subject_set.object", "in": "query" }, { "type": "string", "description": "Relation of the Subject Set", "name": "subject_set.relation", "in": "query" } ], "responses": { "200": { "description": "getRelationTuplesResponse", "schema": { "$ref": "#/definitions/getRelationTuplesResponse" } }, "404": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } }, "500": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } } } } }, "/relation-tuples/check": { "get": { "description": "To learn how relation tuples and the check works, head over to [the documentation](../concepts/relation-tuples.mdx).", "consumes": ["application/x-www-form-urlencoded"], "produces": ["application/json"], "schemes": ["http", "https"], "tags": ["read"], "summary": "Check a relation tuple", "operationId": "getCheck", "parameters": [ { "type": "string", "description": "Namespace of the Relation Tuple", "name": "namespace", "in": "query" }, { "type": "string", "description": "Object of the Relation Tuple", "name": "object", "in": "query" }, { "type": "string", "description": "Relation of the Relation Tuple", "name": "relation", "in": "query" }, { "type": "string", "description": "SubjectID of the Relation Tuple", "name": "subject_id", "in": "query" }, { "type": "string", "description": "Namespace of the Subject Set", "name": "subject_set.namespace", "in": "query" }, { "type": "string", "description": "Object of the Subject Set", "name": "subject_set.object", "in": "query" }, { "type": "string", "description": "Relation of the Subject Set", "name": "subject_set.relation", "in": "query" }, { "type": "integer", "format": "int64", "name": "max-depth", "in": "query" } ], "responses": { "200": { "description": "getCheckResponse", "schema": { "$ref": "#/definitions/getCheckResponse" } }, "400": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } }, "403": { "description": "getCheckResponse", "schema": { "$ref": "#/definitions/getCheckResponse" } }, "500": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } } } }, "post": { "description": "To learn how relation tuples and the check works, head over to [the documentation](../concepts/relation-tuples.mdx).", "consumes": ["application/json"], "produces": ["application/json"], "schemes": ["http", "https"], "tags": ["read"], "summary": "Check a relation tuple", "operationId": "postCheck", "parameters": [ { "name": "Payload", "in": "body", "schema": { "$ref": "#/definitions/RelationQuery" } }, { "type": "integer", "format": "int64", "name": "max-depth", "in": "query" } ], "responses": { "200": { "description": "getCheckResponse", "schema": { "$ref": "#/definitions/getCheckResponse" } }, "400": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } }, "403": { "description": "getCheckResponse", "schema": { "$ref": "#/definitions/getCheckResponse" } }, "500": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } } } } }, "/relation-tuples/expand": { "get": { "description": "Use this endpoint to expand a relation tuple.", "consumes": ["application/x-www-form-urlencoded"], "produces": ["application/json"], "schemes": ["http", "https"], "tags": ["read"], "summary": "Expand a Relation Tuple", "operationId": "getExpand", "parameters": [ { "type": "string", "description": "Namespace of the Subject Set", "name": "namespace", "in": "query", "required": true }, { "type": "string", "description": "Object of the Subject Set", "name": "object", "in": "query", "required": true }, { "type": "string", "description": "Relation of the Subject Set", "name": "relation", "in": "query", "required": true }, { "type": "integer", "format": "int64", "name": "max-depth", "in": "query" } ], "responses": { "200": { "description": "expandTree", "schema": { "$ref": "#/definitions/expandTree" } }, "400": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } }, "404": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } }, "500": { "description": "genericError", "schema": { "$ref": "#/definitions/genericError" } } } } }, "/version": { "get": { "description": "This endpoint returns the service version typically notated using semantic versioning.\n\nIf the service supports TLS Edge Termination, this endpoint does not require the\n`X-Forwarded-Proto` header to be set.\n\nBe aware that if you are running multiple nodes of this service, the health status will never\nrefer to the cluster state, only to a single instance.", "produces": ["application/json"], "tags": ["version"], "summary": "Get service version", "operationId": "getVersion", "responses": { "200": { "description": "version", "schema": { "$ref": "#/definitions/version" } } } } } }, "definitions": { "InternalRelationTuple": { "type": "object", "required": ["namespace", "object", "relation"], "properties": { "namespace": { "description": "Namespace of the Relation Tuple", "type": "string" }, "object": { "description": "Object of the Relation Tuple", "type": "string" }, "relation": { "description": "Relation of the Relation Tuple", "type": "string" }, "subject_id": { "description": "SubjectID of the Relation Tuple\n\nEither SubjectSet or SubjectID are required.", "type": "string" }, "subject_set": { "$ref": "#/definitions/SubjectSet" } } }, "PatchDelta": { "type": "object", "properties": { "action": { "type": "string", "enum": ["insert", "delete"] }, "relation_tuple": { "$ref": "#/definitions/InternalRelationTuple" } } }, "RelationQuery": { "type": "object", "properties": { "namespace": { "description": "Namespace of the Relation Tuple", "type": "string" }, "object": { "description": "Object of the Relation Tuple", "type": "string" }, "relation": { "description": "Relation of the Relation Tuple", "type": "string" }, "subject_id": { "description": "SubjectID of the Relation Tuple\n\nEither SubjectSet or SubjectID can be provided.", "type": "string" }, "subject_set": { "$ref": "#/definitions/SubjectSet" } } }, "SubjectSet": { "type": "object", "required": ["namespace", "object", "relation"], "properties": { "namespace": { "description": "Namespace of the Subject Set", "type": "string" }, "object": { "description": "Object of the Subject Set", "type": "string" }, "relation": { "description": "Relation of the Subject Set", "type": "string" } } }, "expandTree": { "type": "object", "required": ["type"], "properties": { "children": { "type": "array", "items": { "$ref": "#/definitions/expandTree" } }, "subject_id": { "type": "string" }, "subject_set": { "$ref": "#/definitions/SubjectSet" }, "type": { "type": "string", "enum": ["union", "exclusion", "intersection", "leaf"] } } }, "genericError": { "description": "The standard error format", "type": "object", "properties": { "code": { "type": "integer", "format": "int64" }, "details": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "message": { "type": "string" }, "reason": { "type": "string" }, "request": { "type": "string" }, "status": { "type": "string" } } }, "getCheckResponse": { "description": "The content of the allowed field is mirrored in the HTTP status code.", "type": "object", "title": "RESTResponse is the response for a check request.", "required": ["allowed"], "properties": { "allowed": { "description": "whether the relation tuple is allowed", "type": "boolean" } } }, "getRelationTuplesResponse": { "type": "object", "properties": { "next_page_token": { "description": "The opaque token to provide in a subsequent request\nto get the next page. It is the empty string iff this is\nthe last page.", "type": "string" }, "relation_tuples": { "type": "array", "items": { "$ref": "#/definitions/InternalRelationTuple" } } } }, "healthNotReadyStatus": { "type": "object", "properties": { "errors": { "description": "Errors contains a list of errors that caused the not ready status.", "type": "object", "additionalProperties": { "type": "string" } } } }, "healthStatus": { "type": "object", "properties": { "status": { "description": "Status always contains \"ok\".", "type": "string" } } }, "subject": { "type": "object" }, "version": { "type": "object", "properties": { "version": { "description": "Version is the service's version.", "type": "string" } } }, "UUID": { "type": "string", "format": "uuid4" } }, "responses": { "emptyResponse": { "description": "Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201." } } }