openapi: 3.0.3 info: contact: email: hi@ory.sh description: | Documentation for all of Ory Keto's REST APIs. gRPC is documented separately. license: name: Apache 2.0 title: Ory Keto API version: "" servers: - url: / paths: /admin/relation-tuples: delete: description: Use this endpoint to delete relationships operationId: deleteRelationships parameters: - description: Namespace of the Relationship explode: true in: query name: namespace required: false schema: type: string style: form - description: Object of the Relationship explode: true in: query name: object required: false schema: type: string style: form - description: Relation of the Relationship explode: true in: query name: relation required: false schema: type: string style: form - description: SubjectID of the Relationship explode: true in: query name: subject_id required: false schema: type: string style: form - description: Namespace of the Subject Set explode: true in: query name: subject_set.namespace required: false schema: type: string style: form - description: Object of the Subject Set explode: true in: query name: subject_set.object required: false schema: type: string style: form - description: Relation of the Subject Set explode: true in: query name: subject_set.relation required: false schema: type: string style: form responses: "204": description: "Empty responses are sent when, for example, resources are\ \ deleted. The HTTP status code for empty responses is typically 204." "400": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Delete Relationships tags: - relationship x-ory-ratelimit-bucket: keto-admin-low patch: description: Use this endpoint to patch one or more relationships. operationId: patchRelationships requestBody: content: application/json: schema: items: $ref: '#/components/schemas/relationshipPatch' type: array x-originalParamName: Body responses: "204": description: "Empty responses are sent when, for example, resources are\ \ deleted. The HTTP status code for empty responses is typically 204." "400": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric "404": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Patch Multiple Relationships tags: - relationship x-ory-ratelimit-bucket: keto-admin-low put: description: Use this endpoint to create a relationship. operationId: createRelationship requestBody: content: application/json: schema: $ref: '#/components/schemas/createRelationshipBody' x-originalParamName: Body responses: "201": content: application/json: schema: $ref: '#/components/schemas/relationship' description: relationship "400": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Create a Relationship tags: - relationship x-ory-ratelimit-bucket: keto-admin-low /health/alive: get: description: |- This endpoint returns a HTTP 200 status code when Ory Keto is accepting incoming HTTP requests. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. operationId: isAlive responses: "200": content: application/json: schema: $ref: '#/components/schemas/isAlive_200_response' description: Ory Keto is ready to accept connections. default: content: text/plain: schema: type: string description: Unexpected error summary: Check HTTP Server Status tags: - metadata /health/ready: get: description: |- This endpoint returns a HTTP 200 status code when Ory Keto is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of Ory Keto, the health status will never refer to the cluster state, only to a single instance. operationId: isReady responses: "200": content: application/json: schema: $ref: '#/components/schemas/isAlive_200_response' description: Ory Keto is ready to accept requests. "503": content: application/json: schema: $ref: '#/components/schemas/isReady_503_response' description: Ory Kratos is not yet ready to accept requests. default: content: text/plain: schema: type: string description: Unexpected error summary: Check HTTP Server and Database Status tags: - metadata /namespaces: get: description: Get all namespaces operationId: listRelationshipNamespaces responses: "200": content: application/json: schema: $ref: '#/components/schemas/relationshipNamespaces' description: relationshipNamespaces default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Query namespaces tags: - relationship x-ory-ratelimit-bucket: keto-admin-low /opl/syntax/check: post: description: The OPL file is expected in the body of the request. operationId: checkOplSyntax requestBody: content: text/plain: schema: $ref: '#/components/schemas/checkOplSyntaxBody' x-originalParamName: Body responses: "200": content: application/json: schema: $ref: '#/components/schemas/checkOplSyntaxResult' description: checkOplSyntaxResult "400": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Check the syntax of an OPL file tags: - relationship x-ory-ratelimit-bucket: keto-admin-medium /relation-tuples: get: description: Get all relationships that match the query. Only the namespace field is required. operationId: getRelationships parameters: - description: |- Items per Page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.com/docs/ecosystem/api-design#pagination). explode: true in: query name: page_size required: false schema: default: 250 format: int64 maximum: 1000 minimum: 1 type: integer style: form - description: |- Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.com/docs/ecosystem/api-design#pagination). explode: true in: query name: page_token required: false schema: type: string style: form - description: Namespace of the Relationship explode: true in: query name: namespace required: false schema: type: string style: form - description: Object of the Relationship explode: true in: query name: object required: false schema: type: string style: form - description: Relation of the Relationship explode: true in: query name: relation required: false schema: type: string style: form - description: SubjectID of the Relationship explode: true in: query name: subject_id required: false schema: type: string style: form - description: Namespace of the Subject Set explode: true in: query name: subject_set.namespace required: false schema: type: string style: form - description: Object of the Subject Set explode: true in: query name: subject_set.object required: false schema: type: string style: form - description: Relation of the Subject Set explode: true in: query name: subject_set.relation required: false schema: type: string style: form responses: "200": content: application/json: schema: $ref: '#/components/schemas/relationships' description: relationships "404": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Query relationships tags: - relationship x-ory-ratelimit-bucket: keto-admin-medium /relation-tuples/batch/check: post: description: "To learn how relationship tuples and the check works, head over\ \ to [the documentation](https://www.ory.com/docs/keto/concepts/api-overview)." operationId: batchCheckPermission parameters: - explode: true in: query name: max-depth required: false schema: format: int64 type: integer style: form requestBody: content: application/json: schema: $ref: '#/components/schemas/batchCheckPermissionBody' x-originalParamName: Body responses: "200": content: application/json: schema: $ref: '#/components/schemas/batchCheckPermissionResult' description: batchCheckPermissionResult "400": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Batch check permissions tags: - permission x-ory-ratelimit-bucket: keto-public-high /relation-tuples/check: get: description: "To learn how relationship tuples and the check works, head over\ \ to [the documentation](https://www.ory.com/docs/keto/concepts/api-overview)." operationId: checkPermissionOrError parameters: - description: Namespace of the Relationship explode: true in: query name: namespace required: false schema: type: string style: form - description: Object of the Relationship explode: true in: query name: object required: false schema: type: string style: form - description: Relation of the Relationship explode: true in: query name: relation required: false schema: type: string style: form - description: SubjectID of the Relationship explode: true in: query name: subject_id required: false schema: type: string style: form - description: Namespace of the Subject Set explode: true in: query name: subject_set.namespace required: false schema: type: string style: form - description: Object of the Subject Set explode: true in: query name: subject_set.object required: false schema: type: string style: form - description: Relation of the Subject Set explode: true in: query name: subject_set.relation required: false schema: type: string style: form - explode: true in: query name: max-depth required: false schema: format: int64 type: integer style: form responses: "200": content: application/json: schema: $ref: '#/components/schemas/checkPermissionResult' description: checkPermissionResult "400": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric "403": content: application/json: schema: $ref: '#/components/schemas/checkPermissionResult' description: checkPermissionResult default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Check a permission tags: - permission x-ory-ratelimit-bucket: keto-public-high post: description: "To learn how relationship tuples and the check works, head over\ \ to [the documentation](https://www.ory.com/docs/keto/concepts/api-overview)." operationId: postCheckPermissionOrError parameters: - explode: true in: query name: max-depth required: false schema: format: int64 type: integer style: form requestBody: content: application/json: schema: $ref: '#/components/schemas/postCheckPermissionOrErrorBody' x-originalParamName: Body responses: "200": content: application/json: schema: $ref: '#/components/schemas/checkPermissionResult' description: checkPermissionResult "400": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric "403": content: application/json: schema: $ref: '#/components/schemas/checkPermissionResult' description: checkPermissionResult default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Check a permission tags: - permission x-ory-ratelimit-bucket: keto-public-high /relation-tuples/check/openapi: get: description: "To learn how relationship tuples and the check works, head over\ \ to [the documentation](https://www.ory.com/docs/keto/concepts/api-overview)." operationId: checkPermission parameters: - description: Namespace of the Relationship explode: true in: query name: namespace required: false schema: type: string style: form - description: Object of the Relationship explode: true in: query name: object required: false schema: type: string style: form - description: Relation of the Relationship explode: true in: query name: relation required: false schema: type: string style: form - description: SubjectID of the Relationship explode: true in: query name: subject_id required: false schema: type: string style: form - description: Namespace of the Subject Set explode: true in: query name: subject_set.namespace required: false schema: type: string style: form - description: Object of the Subject Set explode: true in: query name: subject_set.object required: false schema: type: string style: form - description: Relation of the Subject Set explode: true in: query name: subject_set.relation required: false schema: type: string style: form - explode: true in: query name: max-depth required: false schema: format: int64 type: integer style: form responses: "200": content: application/json: schema: $ref: '#/components/schemas/checkPermissionResult' description: checkPermissionResult "400": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Check a permission tags: - permission x-ory-ratelimit-bucket: keto-public-high post: description: "To learn how relationship tuples and the check works, head over\ \ to [the documentation](https://www.ory.com/docs/keto/concepts/api-overview)." operationId: postCheckPermission parameters: - explode: true in: query name: max-depth required: false schema: format: int64 type: integer style: form requestBody: content: application/json: schema: $ref: '#/components/schemas/postCheckPermissionBody' x-originalParamName: Payload responses: "200": content: application/json: schema: $ref: '#/components/schemas/checkPermissionResult' description: checkPermissionResult "400": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Check a permission tags: - permission x-ory-ratelimit-bucket: keto-public-high /relation-tuples/expand: get: description: Use this endpoint to expand a relationship tuple into permissions. operationId: expandPermissions parameters: - description: Namespace of the Subject Set explode: true in: query name: namespace required: true schema: type: string style: form - description: Object of the Subject Set explode: true in: query name: object required: true schema: type: string style: form - description: Relation of the Subject Set explode: true in: query name: relation required: true schema: type: string style: form - explode: true in: query name: max-depth required: false schema: format: int64 type: integer style: form responses: "200": content: application/json: schema: $ref: '#/components/schemas/expandedPermissionTree' description: expandedPermissionTree "400": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric "404": content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric default: content: application/json: schema: $ref: '#/components/schemas/errorGeneric' description: errorGeneric summary: Expand a Relationship into permissions. tags: - permission x-ory-ratelimit-bucket: keto-admin-medium /version: get: description: |- This endpoint returns the version of Ory Keto. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the version will never refer to the cluster state, only to a single instance. operationId: getVersion responses: "200": content: application/json: schema: $ref: '#/components/schemas/getVersion_200_response' description: Returns the Ory Keto version. summary: Return Running Software Version. tags: - metadata components: responses: emptyResponse: description: "Empty responses are sent when, for example, resources are deleted.\ \ The HTTP status code for empty responses is typically 204." schemas: DefaultError: description: |- From https://go.dev/wiki/CodeReviewComments#receiver-type: > Can function or methods, either concurrently or when called from this method, be mutating the receiver? A value type creates a copy of the receiver when the method is invoked, so outside updates will not be applied to this receiver. If changes must be visible in the original receiver, the receiver must be a pointer. > If the receiver is a struct, array or slice and any of its elements is a pointer to something that might be mutating, > prefer a pointer receiver, as it will make the intention clearer to the reader. > Don’t mix receiver types. Choose either pointers or struct types for all available methods. title: |- DefaultError is not safe to shallow copy because it contains fields which are not value types, e.g. maps. A shallow copy would inadvertently share these underlying fields, leading to incorrect behavior and data races in a concurrent context. Consequently, all methods take the type by pointer and not by value. ParseError: example: start: Line: 0 column: 6 end: Line: 0 column: 6 message: message properties: end: $ref: '#/components/schemas/SourcePosition' message: type: string start: $ref: '#/components/schemas/SourcePosition' type: object SourcePosition: example: Line: 0 column: 6 properties: Line: format: int64 type: integer column: format: int64 type: integer type: object UUID: format: uuid4 type: string batchCheckPermissionBody: description: Batch Check Permission Body properties: tuples: items: $ref: '#/components/schemas/relationship' type: array type: object batchCheckPermissionResult: description: Batch Check Permission Result example: results: - allowed: true error: error - allowed: true error: error properties: results: description: An array of check results. The order aligns with the input order. items: $ref: '#/components/schemas/checkPermissionResultWithError' type: array required: - results type: object checkOplSyntaxBody: description: Ory Permission Language Document type: string checkOplSyntaxResult: example: errors: - start: Line: 0 column: 6 end: Line: 0 column: 6 message: message - start: Line: 0 column: 6 end: Line: 0 column: 6 message: message properties: errors: description: The list of syntax errors items: $ref: '#/components/schemas/ParseError' type: array title: CheckOPLSyntaxResponse represents the response for an OPL syntax check request. type: object checkPermissionResult: description: The content of the allowed field is mirrored in the HTTP status code. example: allowed: true properties: allowed: description: whether the relation tuple is allowed type: boolean required: - allowed title: Check Permission Result type: object checkPermissionResultWithError: description: Check Permission Result With Error example: allowed: true error: error properties: allowed: description: whether the relation tuple is allowed type: boolean error: description: any error generated while checking the relation tuple type: string required: - allowed type: object createRelationshipBody: description: Create Relationship Request Body properties: namespace: description: Namespace to query type: string object: description: Object to query type: string relation: description: Relation to query type: string subject_id: description: |- SubjectID to query Either SubjectSet or SubjectID can be provided. type: string subject_set: $ref: '#/components/schemas/subjectSet' type: object errorGeneric: description: The standard Ory JSON API error format. properties: error: $ref: '#/components/schemas/genericError' required: - error title: JSON API Error Response type: object expandedPermissionTree: example: tuple: subject_id: subject_id namespace: namespace object: object relation: relation subject_set: namespace: namespace object: object relation: relation children: - null - null type: union properties: children: description: "The children of the node, possibly none." items: $ref: '#/components/schemas/expandedPermissionTree' type: array tuple: $ref: '#/components/schemas/relationship' type: description: |- The type of the node. union TreeNodeUnion exclusion TreeNodeExclusion intersection TreeNodeIntersection leaf TreeNodeLeaf tuple_to_subject_set TreeNodeTupleToSubjectSet computed_subject_set TreeNodeComputedSubjectSet not TreeNodeNot unspecified TreeNodeUnspecified enum: - union - exclusion - intersection - leaf - tuple_to_subject_set - computed_subject_set - not - unspecified type: string x-go-enum-desc: |- union TreeNodeUnion exclusion TreeNodeExclusion intersection TreeNodeIntersection leaf TreeNodeLeaf tuple_to_subject_set TreeNodeTupleToSubjectSet computed_subject_set TreeNodeComputedSubjectSet not TreeNodeNot unspecified TreeNodeUnspecified required: - type type: object genericError: properties: code: description: The status code example: 404 format: int64 type: integer debug: description: |- Debug information This field is often not exposed to protect against leaking sensitive information. example: SQL field "foo" is not a bool. type: string details: additionalProperties: {} description: Further error details type: object id: description: |- The error ID Useful when trying to identify various errors in application logic. type: string message: description: |- Error message The error's message. example: The resource could not be found type: string reason: description: A human-readable reason for the error example: User with ID 1234 does not exist. type: string request: description: |- The request ID The request ID is often exposed internally in order to trace errors across service architectures. This is often a UUID. example: d7ef54b1-ec15-46e6-bccb-524b82c035e6 type: string status: description: The status description example: Not Found type: string required: - message type: object healthNotReadyStatus: properties: errors: additionalProperties: type: string description: Errors contains a list of errors that caused the not ready status. type: object title: The not ready status of the service. type: object healthStatus: properties: status: description: Status always contains "ok". type: string title: The health status of the service. type: object namespace: example: name: name properties: name: description: Name of the namespace. type: string type: object postCheckPermissionBody: description: Check Permission using Post Request Body properties: namespace: description: Namespace to query type: string object: description: Object to query type: string relation: description: Relation to query type: string subject_id: description: |- SubjectID to query Either SubjectSet or SubjectID can be provided. type: string subject_set: $ref: '#/components/schemas/subjectSet' type: object postCheckPermissionOrErrorBody: description: Post Check Permission Or Error Body properties: namespace: description: Namespace to query type: string object: description: Object to query type: string relation: description: Relation to query type: string subject_id: description: |- SubjectID to query Either SubjectSet or SubjectID can be provided. type: string subject_set: $ref: '#/components/schemas/subjectSet' type: object relationQuery: description: Relation Query properties: namespace: description: Namespace to query type: string object: description: Object to query type: string relation: description: Relation to query type: string subject_id: description: |- SubjectID to query Either SubjectSet or SubjectID can be provided. type: string subject_set: $ref: '#/components/schemas/subjectSet' type: object relationship: description: Relationship example: subject_id: subject_id namespace: namespace object: object relation: relation subject_set: namespace: namespace object: object relation: 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 Either SubjectSet or SubjectID can be provided. type: string subject_set: $ref: '#/components/schemas/subjectSet' required: - namespace - object - relation type: object relationshipNamespaces: description: Relationship Namespace List example: namespaces: - name: name - name: name properties: namespaces: items: $ref: '#/components/schemas/namespace' type: array type: object relationshipPatch: description: Payload for patching a relationship properties: action: enum: - insert - delete type: string x-go-enum-desc: |- insert ActionInsert delete ActionDelete relation_tuple: $ref: '#/components/schemas/relationship' type: object relationships: description: Paginated Relationship List example: next_page_token: next_page_token relation_tuples: - subject_id: subject_id namespace: namespace object: object relation: relation subject_set: namespace: namespace object: object relation: relation - subject_id: subject_id namespace: namespace object: object relation: relation subject_set: namespace: namespace object: object relation: relation properties: next_page_token: description: |- The opaque token to provide in a subsequent request to get the next page. It is the empty string iff this is the last page. type: string relation_tuples: items: $ref: '#/components/schemas/relationship' type: array type: object subjectSet: example: namespace: namespace object: object relation: 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 required: - namespace - object - relation type: object unexpectedError: type: string version: properties: version: description: Version is the service's version. type: string type: object isAlive_200_response: example: status: status properties: status: description: Always "ok". type: string required: - status type: object isReady_503_response: properties: errors: additionalProperties: type: string description: Errors contains a list of errors that caused the not ready status. type: object required: - errors type: object getVersion_200_response: example: version: version properties: version: description: The version of Ory Keto. type: string required: - version type: object