> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cortex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create relationship type

> Create a relationship type



## OpenAPI

````yaml /openapi/cortex_swagger.json post /api/v1/relationship-types
openapi: 3.0.1
info:
  description: >-
    The Cortex REST API provides programmatic access to the data in the catalog,
    Scorecards, and more.
  title: Cortex API
  version: v1
servers:
  - url: https://api.getcortexapp.com
    description: Cortex Cloud API host
security:
  - bearerAuth: []
tags:
  - name: API Keys
  - name: Audit Logs
  - name: Catalog Entities
  - name: Catalogs
  - name: Custom Data
  - name: Custom Data [Advanced]
  - name: Custom Events
  - name: Custom Metrics
  - name: Dependencies
  - name: Deploys
  - name: Discovery Audit
  - name: Docs
  - name: 'Eng Intel: 1-Registry'
  - name: 'Eng Intel: 2-Metrics'
  - name: 'Eng Intel: 3-Trace'
  - name: 'Eng Intel: User Labels'
  - name: Entity Relationship Types
  - name: Entity Relationships
  - name: Entity Types
  - name: GitOps Logs
  - name: Groups
  - name: IP Allowlist
  - name: Initiatives
  - name: My Workspace
  - name: Notification Logs
  - name: On-call
  - name: Packages
  - name: Plugins
  - name: Queries
  - name: SCIM
  - name: Scaffolder
  - name: Scorecards
  - name: Secrets
  - name: Team Roles
  - name: Teams
  - name: Teams Hierarchies
  - name: Teams [Advanced]
  - name: Teams [Departments] (legacy)
  - name: Users
  - name: Verifications
  - name: Workflows
  - name: '[Integrations] AWS'
  - name: '[Integrations] Anthropic'
  - name: '[Integrations] Apiiro'
  - name: '[Integrations] ArgoCD'
  - name: '[Integrations] Azure Active Directory'
  - name: '[Integrations] Azure Devops'
  - name: '[Integrations] Azure Resources'
  - name: '[Integrations] BambooHR'
  - name: '[Integrations] Bitbucket'
  - name: '[Integrations] Bugsnag'
  - name: '[Integrations] Buildkite'
  - name: '[Integrations] Checkmarx SAST'
  - name: '[Integrations] CircleCI'
  - name: '[Integrations] ClickUp'
  - name: '[Integrations] Codecov'
  - name: '[Integrations] Coralogix'
  - name: '[Integrations] Datadog'
  - name: '[Integrations] Dynatrace'
  - name: '[Integrations] Firehydrant'
  - name: '[Integrations] GitHub'
  - name: '[Integrations] GitLab'
  - name: '[Integrations] Harness'
  - name: '[Integrations] Incident.io'
  - name: '[Integrations] Instana'
  - name: '[Integrations] Jenkins'
  - name: '[Integrations] Jira'
  - name: '[Integrations] Kubernetes'
  - name: '[Integrations] LaunchDarkly'
  - name: '[Integrations] Lightstep'
  - name: '[Integrations] Mend SAST'
  - name: '[Integrations] Mend SCA'
  - name: '[Integrations] New Relic'
  - name: '[Integrations] Okta'
  - name: '[Integrations] Opsgenie'
  - name: '[Integrations] PagerDuty'
  - name: '[Integrations] Prometheus'
  - name: '[Integrations] Rollbar'
  - name: '[Integrations] Rootly'
  - name: '[Integrations] Semgrep'
  - name: '[Integrations] Sentry'
  - name: '[Integrations] ServiceNow'
  - name: '[Integrations] SignalFx'
  - name: '[Integrations] Snyk'
  - name: '[Integrations] SonarQube'
  - name: '[Integrations] SumoLogic'
  - name: '[Integrations] Veracode'
  - name: '[Integrations] VictorOps'
  - name: '[Integrations] Wiz'
  - name: '[Integrations] Workday'
  - name: '[Integrations] xMatters'
  - name: dev-login-controller
  - name: public-scim-schema-controller
paths:
  /api/v1/relationship-types:
    post:
      tags:
        - Entity Relationship Types
      summary: Create relationship type
      description: Create a relationship type
      operationId: createRelationshipType
      requestBody:
        content:
          application/json:
            examples:
              Entity Relationship Type Example:
                description: Entity Relationship Type Example
                summary: >-
                  Creates a relationship type that groups services into
                  components
                value: |-
                  {
                                          "name": "Component Hierarchy",
                                          "tag": "component-hierarchy",
                                          "description": "Defines the component hierarchy.",
                                          "definitionLocation": "BOTH",
                                          "isSingleSource": true,
                                          "sourcesFilter": {
                                              "include": true,
                                              "types": ["component"]
                                          },
                                          "isSingleDestination": false,
                                          "destinationsFilter": {
                                              "include": true,
                                              "types": ["service", "component]
                                          },
                                          "inheritances": [
                                              {
                                                  "parameterTag": "x-cortex-owners",
                                                  "inheritanceType": "FALLBACK"
                                              }
                                          ],
                                          "allowCycles": false,
                                          "sourceLabelSingular": "Component",
                                          "sourceLabelPlural": "Components",
                                          "destinationLabelSingular": "Part",
                                          "destinationLabelPlural": "Parts",
                                          "createCatalog": false
                                      }
            schema:
              $ref: '#/components/schemas/EntityRelationshipTypeRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EntityRelationshipTypeResponse'
          description: Successfully created relationship type
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Validation error creating relationship type
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    EntityRelationshipTypeRequest:
      required:
        - allowCycles
        - createCatalog
        - definitionLocation
        - destinationsFilter
        - inheritances
        - isSingleDestination
        - isSingleSource
        - name
        - sourcesFilter
        - tag
      type: object
      properties:
        allowCycles:
          type: boolean
          description: Whether cyclical relationships are allowed
          example: false
        createCatalog:
          type: boolean
          description: Whether to create a catalog page for this relationship type
          example: false
        definitionLocation:
          type: string
          description: Defines where a relationship can be configured in entity descriptors
          example: BOTH
          enum:
            - SOURCE
            - DESTINATION
            - BOTH
        description:
          type: string
          description: Optional description explaining the relationship type
          example: Defines the component hierarchy
        destinationLabelPlural:
          type: string
          description: Plural label for destinations in the relationship
          example: Parts
        destinationLabelSingular:
          type: string
          description: Singular label for destinations in the relationship
          example: Part
        destinationsFilter:
          $ref: '#/components/schemas/EntityTypeFilter'
        inheritances:
          type: array
          description: >-
            Inheritance configuration for Cortex parameters. Currently supports
            ownership inheritance via x-cortex-owners.
          items:
            $ref: '#/components/schemas/EntityRelationshipTypeInheritanceView'
        isSingleDestination:
          type: boolean
          description: >-
            Whether an entity can have only one destination for this
            relationship type
          example: false
        isSingleSource:
          type: boolean
          description: >-
            Whether an entity can have only one source for this relationship
            type
          example: false
        name:
          type: string
          description: Human-readable name for the relationship type
          example: Component Hierarchy
        sourceLabelPlural:
          type: string
          description: Plural label for sources in the relationship
          example: Components
        sourceLabelSingular:
          type: string
          description: Singular label for sources in the relationship
          example: Component
        sourcesFilter:
          $ref: '#/components/schemas/EntityTypeFilter'
        tag:
          type: string
          description: Unique identifier tag for the relationship type
          example: component-hierarchy
      description: Request to create or update a relationship type
    EntityRelationshipTypeResponse:
      required:
        - allowCycles
        - definitionLocation
        - destinationsFilter
        - inheritances
        - isCortexManaged
        - isSingleDestination
        - isSingleSource
        - name
        - sourcesFilter
        - tag
      type: object
      properties:
        allowCycles:
          type: boolean
          description: Whether cyclical relationships are allowed
          example: false
        definitionLocation:
          type: string
          description: Defines where a relationship can be configured in entity descriptors
          example: BOTH
          enum:
            - SOURCE
            - DESTINATION
            - BOTH
        description:
          type: string
          description: Optional description explaining the relationship type
          example: Defines the component hierarchy
        destinationLabelPlural:
          type: string
          description: Plural label for destinations in the relationship
          example: Parts
        destinationLabelSingular:
          type: string
          description: Singular label for destinations in the relationship
          example: Part
        destinationNamePlural:
          type: string
        destinationNameSingular:
          type: string
        destinationsFilter:
          $ref: '#/components/schemas/EntityTypeFilter'
        inheritances:
          type: array
          description: >-
            Inheritance configuration for Cortex parameters. Currently supports
            ownership inheritance via x-cortex-owners.
          items:
            $ref: '#/components/schemas/EntityRelationshipTypeInheritanceView'
        isCortexManaged:
          type: boolean
          description: Whether this relationship type is managed by Cortex
          example: false
        isSingleDestination:
          type: boolean
          description: >-
            Whether an entity can have only one destination for this
            relationship type
          example: false
        isSingleSource:
          type: boolean
          description: >-
            Whether an entity can have only one source for this relationship
            type
          example: false
        name:
          type: string
          description: Human-readable name for the relationship type
          example: Component Hierarchy
        sourceLabelPlural:
          type: string
          description: Plural label for sources in the relationship
          example: Components
        sourceLabelSingular:
          type: string
          description: Singular label for sources in the relationship
          example: Component
        sourceNamePlural:
          type: string
        sourceNameSingular:
          type: string
        sourcesFilter:
          $ref: '#/components/schemas/EntityTypeFilter'
        tag:
          type: string
          description: Unique identifier tag for the relationship type
          example: component-hierarchy
      description: Response containing relationship type details
    ErrorResponse:
      required:
        - message
        - type
      type: object
      properties:
        details:
          type: string
        errorCode:
          type: string
        gatewayHttpStatus:
          type: integer
          format: int32
        httpStatus:
          type: integer
          format: int32
        message:
          type: string
        requestId:
          type: string
        type:
          type: string
          enum:
            - INTEGRATION_MISSING
            - INTEGRATION_UNREGISTERED
            - INTEGRATION_UNSUPPORTED
            - INTEGRATION_GRAPHQL_ERROR
            - INTEGRATION_BAD_REQUEST
            - INTEGRATION_UNAUTHORIZED
            - INTEGRATION_FORBIDDEN
            - INTEGRATION_NOT_FOUND
            - INTEGRATION_UNPROCESSABLE_CONTENT
            - INTEGRATION_RATE_LIMITED
            - INTEGRATION_INTERNAL_ERROR
            - INTEGRATION_NOT_IMPLEMENTED
            - INTEGRATION_BAD_GATEWAY
            - INTEGRATION_UNAVAILABLE
            - INTEGRATION_GATEWAY_TIMEOUT
            - INTEGRATION_TIMED_OUT
            - INTEGRATION_CACHE_ERROR
            - INTEGRATION_UNHANDLED_HTTP_ERROR
            - INTEGRATION_UNHANDLED_EXCEPTION
            - INTEGRATION_UNEXPECTED_ERROR
            - ILLEGAL_ARGUMENT_ERROR
            - BAD_REQUEST
            - FORBIDDEN
            - NOT_FOUND
            - REQUEST_TIMEOUT
            - CONFLICT
            - UNHANDLED_EXCEPTION
            - UNCATEGORIZED
            - SERVICE_CREATOR
            - UNKNOWN_HOST
            - TOO_MANY_REQUESTS
    EntityTypeFilter:
      required:
        - include
        - providers
        - types
      type: object
      properties:
        include:
          type: boolean
        providers:
          uniqueItems: true
          type: array
          items:
            type: string
            enum:
              - AWS
              - GCP
              - AZURE
        types:
          uniqueItems: true
          type: array
          items:
            type: string
    EntityRelationshipTypeInheritanceView:
      required:
        - inheritanceType
        - parameterTag
      type: object
      properties:
        inheritanceType:
          type: string
          description: How relationship inheritance should be handled for this parameter
          enum:
            - NONE
            - FALLBACK
            - APPEND
            - CONFIGURE_AT_SOURCE
        parameterTag:
          type: string
      description: >-
        Inheritance configuration for Cortex parameters. Currently supports
        ownership inheritance via x-cortex-owners.
    TooManyRequestsProblemDetail:
      required:
        - type
        - title
        - status
      type: object
      properties:
        detail:
          type: string
        instance:
          type: string
          format: uri-reference
        retryAfter:
          minimum: 0
          type: integer
          description: The number of seconds until the rate limiting resets.
          format: int32
        status:
          maximum: 599
          minimum: 100
          type: integer
          format: int32
          enum:
            - 429
        title:
          type: string
        type:
          type: string
          format: uri-reference
  responses:
    TooManyRequests:
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/TooManyRequestsProblemDetail'
      description: >-
        The client has exceeded the rate limit by performing too many requests
        in a short period. Retry the request after a delay.
      headers:
        Retry-After:
          description: The number of seconds until the rate limiting resets.
          schema:
            minimum: 0
            type: integer
            format: int32
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      description: >-
        All requests to the Cortex API need to provide an `Authorization: Bearer
        <token>` header, where `<token>` is an API key created in the Settings
        page of your workspace.
      scheme: bearer
      type: http

````

## Related topics

- [Managing relationships](/ingesting-data-into-cortex/entities-overview/entities/defining-relationship-types/managing-relationships.md)
- [Entity Relationship Types](/api/rest/entity-relationship-types.md)
- [Defining relationship types](/ingesting-data-into-cortex/entities-overview/entities/defining-relationship-types.md)
