Skip to main content

Protocol buffers API

Protocol Documentation

Table of Contents

Top

ory/keto/opl/v1alpha1/syntax_service.proto

CheckRequest

FieldTypeLabelDescription
contentbytes

CheckResponse

FieldTypeLabelDescription
parse_errorsParseErrorrepeated

ParseError

FieldTypeLabelDescription
messagestring
startSourcePosition
endSourcePosition

SourcePosition

FieldTypeLabelDescription
lineuint32
columnuint32

SyntaxService

The service that checks the syntax of an OPL file.

Method NameRequest TypeResponse TypeDescription
CheckCheckRequestCheckResponsePerforms a syntax check request.

Top

ory/keto/relation_tuples/v1alpha2/relation_tuples.proto

RelationQuery

The query for listing relationships. Clients can specify any optional field to partially filter for specific relationships.

Example use cases (namespace is always required):

  • object only: display a list of all permissions referring to a specific object
  • relation only: get all groups that have members; get all directories that have content
  • object & relation: display all subjects that have a specific permission relation
  • subject & relation: display all groups a subject belongs to; display all objects a subject has access to
  • object & relation & subject: check whether the relation tuple already exists
FieldTypeLabelDescription
namespacestringoptionalThe namespace this relation tuple lives in.
objectstringoptionalThe object related by this tuple. It is an object in the namespace of the tuple.
relationstringoptionalThe relation between an Object and a Subject.
subjectSubjectoptionalThe subject related by this tuple. A Subject either represents a concrete subject id or a SubjectSet that expands to more Subjects.

RelationTuple

RelationTuple defines a relation between an Object and a Subject.

FieldTypeLabelDescription
namespacestringThe namespace this relation tuple lives in.
objectstringThe object related by this tuple. It is an object in the namespace of the tuple.
relationstringThe relation between an Object and a Subject.
subjectSubjectThe subject related by this tuple. A Subject either represents a concrete subject id or a SubjectSet that expands to more Subjects.

Subject

Subject is either a concrete subject id or a SubjectSet expanding to more Subjects.

FieldTypeLabelDescription
idstringA concrete id of the subject.
setSubjectSetA subject set that expands to more Subjects. More information are available under concepts.

SubjectSet

SubjectSet refers to all subjects who have the same relation on an object.

FieldTypeLabelDescription
namespacestringThe namespace of the object and relation referenced in this subject set.
objectstringThe object related by this subject set.
relationstringThe relation between the object and the subjects.

Top

ory/keto/relation_tuples/v1alpha2/check_service.proto

CheckRequest

The request for a CheckService.Check RPC. Checks whether a specific subject is related to an object.

FieldTypeLabelDescription
namespacestringDeprecated. The namespace to evaluate the check.

Note: If you use the expand-API and the check evaluates a RelationTuple specifying a SubjectSet as subject or due to a rewrite rule in a namespace config this check request may involve other namespaces automatically. | | object | string | | Deprecated. The related object in this check. | | relation | string | | Deprecated. The relation between the Object and the Subject. | | subject | Subject | | Deprecated. The related subject in this check. | | tuple | RelationTuple | | | | latest | bool | | This field is not implemented yet and has no effect. <!-- Set this field to true in case your application needs to authorize depending on up to date ACLs, also called a "content-change check".

If set to true the snaptoken field is ignored, the check is evaluated at the latest snapshot (globally consistent) and the response includes a snaptoken for clients to store along with object contents that can be used for subsequent checks of the same content version.

Example use case: - You need to authorize a user to modify/delete some resource and it is unacceptable that if the permission to do that had just been revoked some seconds ago so that the change had not yet been fully replicated to all availability zones. --> | | snaptoken | string | | This field is not implemented yet and has no effect. <!-- Optional. Like reads, a check is always evaluated at a consistent snapshot no earlier than the given snaptoken.

Leave this field blank if you want to evaluate the check based on eventually consistent ACLs, benefiting from very low latency, but possibly slightly stale results.

If the specified token is too old and no longer known, the server falls back as if no snaptoken had been specified.

If not specified the server tries to evaluate the check on the best snapshot version where it is very likely that ACLs had already been replicated to all availability zones. --> | | max_depth | int32 | | The maximum depth to search for a relation.

If the value is less than 1 or greater than the global max-depth then the global max-depth will be used instead. |

CheckResponse

The response for a CheckService.Check rpc.

FieldTypeLabelDescription
allowedboolWhether the specified subject (id) is related to the requested object.

It is false by default if no ACL matches. | | snaptoken | string | | This field is not implemented yet and has no effect. <!-- The last known snapshot token ONLY specified if the request had not specified a snaptoken, since this performed a "content-change request" and consistently fetched the last known snapshot token.

This field is not set if the request had specified a snaptoken!

If set, clients should cache and use this token for subsequent requests to have minimal latency, but allow slightly stale responses (only some milliseconds or seconds). --> |

CheckService

The service that performs authorization checks based on the stored Access Control Lists.

This service is part of the read-APIs.

Method NameRequest TypeResponse TypeDescription
CheckCheckRequestCheckResponsePerforms an authorization check.

Top

ory/keto/relation_tuples/v1alpha2/expand_service.proto

ExpandRequest

The request for an ExpandService.Expand RPC. Expands the given subject set.

FieldTypeLabelDescription
subjectSubjectThe subject to expand.
max_depthint32The maximum depth of tree to build.

If the value is less than 1 or greater than the global max-depth then the global max-depth will be used instead.

It is important to set this parameter to a meaningful value. Ponder how deep you really want to display this. | | snaptoken | string | | This field is not implemented yet and has no effect. <!-- Optional. Like reads, a expand is always evaluated at a consistent snapshot no earlier than the given snaptoken.

Leave this field blank if you want to expand based on eventually consistent ACLs, benefiting from very low latency, but possibly slightly stale results.

If the specified token is too old and no longer known, the server falls back as if no snaptoken had been specified.

If not specified the server tries to build the tree on the best snapshot version where it is very likely that ACLs had already been replicated to all availability zones. --> |

ExpandResponse

The response for a ExpandService.Expand RPC.

FieldTypeLabelDescription
treeSubjectTreeThe tree the requested subject set expands to. The requested subject set is the subject of the root.

This field can be nil in some circumstances. |

SubjectTree

FieldTypeLabelDescription
node_typeNodeTypeThe type of the node.
subjectSubjectDeprecated. The subject this node represents. Deprecated: More information is now available in the tuple field.
tupleRelationTupleThe relation tuple this node represents.
childrenSubjectTreerepeatedThe children of this node.

This is never set if node_type == NODE_TYPE_LEAF. |

NodeType

NameNumberDescription
NODE_TYPE_UNSPECIFIED0
NODE_TYPE_UNION1This node expands to a union of all children.
NODE_TYPE_EXCLUSION2Not implemented yet.
NODE_TYPE_INTERSECTION3Not implemented yet.
NODE_TYPE_LEAF4This node is a leaf and contains no children. Its subject is a SubjectID unless max_depth was reached.

ExpandService

The service that performs subject set expansion based on the stored Access Control Lists.

This service is part of the read-APIs.

Method NameRequest TypeResponse TypeDescription
ExpandExpandRequestExpandResponseExpands the subject set into a tree of subjects.

Top

ory/keto/relation_tuples/v1alpha2/namespaces_service.proto

ListNamespacesRequest

Request for ReadService.ListNamespaces RPC.

ListNamespacesResponse

FieldTypeLabelDescription
namespacesNamespacerepeated

Namespace

FieldTypeLabelDescription
namestring

NamespacesService

The service to query namespaces.

This service is part of the read-APIs.

Method NameRequest TypeResponse TypeDescription
ListNamespacesListNamespacesRequestListNamespacesResponseLists Namespaces

Top

ory/keto/relation_tuples/v1alpha2/read_service.proto

ListRelationTuplesRequest

Request for ReadService.ListRelationTuples RPC. See ListRelationTuplesRequest_Query for how to filter the query.

FieldTypeLabelDescription
queryListRelationTuplesRequest.QueryDeprecated. All query constraints are concatenated with a logical AND operator.

The RelationTuple list from ListRelationTuplesResponse is ordered from the newest RelationTuple to the oldest. | | relation_query | RelationQuery | | | | expand_mask | google.protobuf.FieldMask | | This field is not implemented yet and has no effect. <!-- Optional. The list of fields to be expanded in the RelationTuple list returned in ListRelationTuplesResponse. Leaving this field unspecified means all fields are expanded.

Available fields: "object", "relation", "subject", "namespace", "subject.id", "subject.namespace", "subject.object", "subject.relation" --> | | snaptoken | string | | This field is not implemented yet and has no effect. <!-- Optional. The snapshot token for this read. --> | | page_size | int32 | | Optional. The maximum number of RelationTuples to return in the response.

Default: 100 | | page_token | string | | Optional. An opaque pagination token returned from a previous call to ListRelationTuples that indicates where the page should start at.

An empty token denotes the first page. All successive pages require the token from the previous page. |

ListRelationTuplesRequest.Query

The query for listing relationships. Clients can specify any optional field to partially filter for specific relationships.

Example use cases (namespace is always required):

  • object only: display a list of all permissions referring to a specific object
  • relation only: get all groups that have members; get all directories that have content
  • object & relation: display all subjects that have a specific permission relation
  • subject & relation: display all groups a subject belongs to; display all objects a subject has access to
  • object & relation & subject: check whether the relation tuple already exists
FieldTypeLabelDescription
namespacestringRequired. The namespace to query.
objectstringOptional. The object to query for.
relationstringOptional. The relation to query for.
subjectSubjectOptional. The subject to query for.

ListRelationTuplesResponse

The response of a ReadService.ListRelationTuples RPC.

FieldTypeLabelDescription
relation_tuplesRelationTuplerepeatedThe relationships matching the list request.
next_page_tokenstringThe token required to get the next page. If this is the last page, the token will be the empty string.

ReadService

The service to query relationships.

This service is part of the read-APIs.

Method NameRequest TypeResponse TypeDescription
ListRelationTuplesListRelationTuplesRequestListRelationTuplesResponseLists ACL relationships.

Top

ory/keto/relation_tuples/v1alpha2/version.proto

GetVersionRequest

Request for the VersionService.GetVersion RPC.

GetVersionResponse

Response of the VersionService.GetVersion RPC.

FieldTypeLabelDescription
versionstringThe version string of the Ory Keto instance.

VersionService

The service returning the specific Ory Keto instance version.

This service is part of the read-APIs and write-APIs.

Method NameRequest TypeResponse TypeDescription
GetVersionGetVersionRequestGetVersionResponseReturns the version of the Ory Keto instance.

Top

ory/keto/relation_tuples/v1alpha2/write_service.proto

DeleteRelationTuplesRequest

FieldTypeLabelDescription
queryDeleteRelationTuplesRequest.QueryDeprecated.
relation_queryRelationQuery

DeleteRelationTuplesRequest.Query

The query for deleting relationships

FieldTypeLabelDescription
namespacestringOptional. The namespace to query.
objectstringOptional. The object to query for.
relationstringOptional. The relation to query for.
subjectSubjectOptional. The subject to query for.

DeleteRelationTuplesResponse

RelationTupleDelta

Write-delta for a TransactRelationTuplesRequest.

FieldTypeLabelDescription
actionRelationTupleDelta.ActionThe action to do on the RelationTuple.
relation_tupleRelationTupleThe target RelationTuple.

TransactRelationTuplesRequest

The request of a WriteService.TransactRelationTuples RPC.

FieldTypeLabelDescription
relation_tuple_deltasRelationTupleDeltarepeatedThe write delta for the relationships operated in one single transaction. Either all actions succeed or no change takes effect on error.

TransactRelationTuplesResponse

The response of a WriteService.TransactRelationTuples rpc.

FieldTypeLabelDescription
snaptokensstringrepeatedThis field is not implemented yet and has no effect. <!-- The list of the new latest snapshot tokens of the affected RelationTuple, with the same index as specified in the relation_tuple_deltas field of the TransactRelationTuplesRequest request.

If the RelationTupleDelta_Action was DELETE the snaptoken is empty at the same index. --> |

RelationTupleDelta.Action

NameNumberDescription
ACTION_UNSPECIFIED0Unspecified. The TransactRelationTuples RPC ignores this RelationTupleDelta if an action was unspecified.
ACTION_INSERT1Insertion of a new RelationTuple. It is ignored if already existing.
ACTION_DELETE2Deletion of the RelationTuple. It is ignored if it does not exist.

WriteService

The write service to create and delete Access Control Lists.

This service is part of the write-APIs.

Method NameRequest TypeResponse TypeDescription
TransactRelationTuplesTransactRelationTuplesRequestTransactRelationTuplesResponseWrites one or more relationships in a single transaction.
DeleteRelationTuplesDeleteRelationTuplesRequestDeleteRelationTuplesResponseDeletes relationships based on relation query

Scalar Value Types

.proto TypeNotesC++JavaPythonGoC#PHPRuby
doubledoubledoublefloatfloat64doublefloatFloat
floatfloatfloatfloatfloat32floatfloatFloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intintint32intintegerBignum or Fixnum (as required)
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/longint64longinteger/stringBignum
uint32Uses variable-length encoding.uint32intint/longuint32uintintegerBignum or Fixnum (as required)
uint64Uses variable-length encoding.uint64longint/longuint64ulonginteger/stringBignum or Fixnum (as required)
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intintint32intintegerBignum or Fixnum (as required)
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/longint64longinteger/stringBignum
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intintuint32uintintegerBignum or Fixnum (as required)
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/longuint64ulonginteger/stringBignum
sfixed32Always four bytes.int32intintint32intintegerBignum or Fixnum (as required)
sfixed64Always eight bytes.int64longint/longint64longinteger/stringBignum
boolboolbooleanbooleanboolboolbooleanTrueClass/FalseClass
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicodestringstringstringString (UTF-8)
bytesMay contain any arbitrary sequence of bytes.stringByteStringstr[]byteByteStringstringString (ASCII-8BIT)