Ory

Ory relationship API

The relationship API from Ory — 4 operation(s) for relationship.

OpenAPI Specification

ory-relationship-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  contact:
    email: hi@ory.sh
  description: 'Documentation for all of Ory Hydra''s APIs.

    '
  license:
    name: Apache 2.0
  title: Ory Hydra api relationship API
  version: ''
tags:
- name: relationship
paths:
  /admin/relation-tuples:
    delete:
      description: Use this endpoint to delete relationships
      operationId: deleteRelationships
      parameters:
      - description: Namespace of the Relationship
        in: query
        name: namespace
        schema:
          type: string
      - description: Object of the Relationship
        in: query
        name: object
        schema:
          type: string
      - description: Relation of the Relationship
        in: query
        name: relation
        schema:
          type: string
      - description: SubjectID of the Relationship
        in: query
        name: subject_id
        schema:
          type: string
      - description: Namespace of the Subject Set
        in: query
        name: subject_set.namespace
        schema:
          type: string
      - description: Object of the Subject Set
        in: query
        name: subject_set.object
        schema:
          type: string
      - description: Relation of the Subject Set
        in: query
        name: subject_set.relation
        schema:
          type: string
      responses:
        '204':
          $ref: '#/components/responses/emptyResponse'
        '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':
          $ref: '#/components/responses/emptyResponse'
        '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
  /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).'
        in: query
        name: page_size
        schema:
          default: 250
          format: int64
          maximum: 1000
          minimum: 1
          type: integer
      - 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).'
        in: query
        name: page_token
        schema:
          type: string
      - description: Namespace of the Relationship
        in: query
        name: namespace
        schema:
          type: string
      - description: Object of the Relationship
        in: query
        name: object
        schema:
          type: string
      - description: Relation of the Relationship
        in: query
        name: relation
        schema:
          type: string
      - description: SubjectID of the Relationship
        in: query
        name: subject_id
        schema:
          type: string
      - description: Namespace of the Subject Set
        in: query
        name: subject_set.namespace
        schema:
          type: string
      - description: Object of the Subject Set
        in: query
        name: subject_set.object
        schema:
          type: string
      - description: Relation of the Subject Set
        in: query
        name: subject_set.relation
        schema:
          type: string
      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
components:
  schemas:
    relationship:
      description: Relationship
      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
    checkOplSyntaxBody:
      description: Ory Permission Language Document
      type: string
    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
    subjectSet:
      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
    SourcePosition:
      properties:
        Line:
          format: int64
          type: integer
        column:
          format: int64
          type: integer
      type: object
    namespace:
      properties:
        name:
          description: Name of the namespace.
          type: string
      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
    relationships:
      description: Paginated Relationship List
      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
    errorGeneric:
      description: The standard Ory JSON API error format.
      properties:
        error:
          $ref: '#/components/schemas/genericError'
      required:
      - error
      title: JSON API Error Response
      type: object
    relationshipNamespaces:
      description: Relationship Namespace List
      properties:
        namespaces:
          items:
            $ref: '#/components/schemas/namespace'
          type: array
      type: object
    ParseError:
      properties:
        end:
          $ref: '#/components/schemas/SourcePosition'
        message:
          type: string
        start:
          $ref: '#/components/schemas/SourcePosition'
      type: object
    checkOplSyntaxResult:
      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
    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
  responses:
    emptyResponse:
      description: Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 204.
  securitySchemes:
    basic:
      scheme: basic
      type: http
    bearer:
      scheme: bearer
      type: http
    oauth2:
      flows:
        authorizationCode:
          authorizationUrl: https://hydra.demo.ory.sh/oauth2/auth
          scopes:
            offline: A scope required when requesting refresh tokens (alias for `offline_access`)
            offline_access: A scope required when requesting refresh tokens
            openid: Request an OpenID Connect ID Token
          tokenUrl: https://hydra.demo.ory.sh/oauth2/token
      type: oauth2
x-forwarded-proto: string
x-request-id: string