Links

Links allow you to create workspace-specific relationships between any two objects in DevRev. This feature enables you to define meaningful connections with custom names that reflect your business processes.

This section provides an overview of links and walks you through the process of creating and managing them. By the end of this section, you'll be able to:

  1. Define link types
  2. Create links between objects
  3. List link types
  4. Update link types
  5. Deprecate link types

Concepts

A link type defines a relationship between two types of objects. It specifies:

  • The source object types that the link initiates from
  • The target object types that the link can be created to
  • A forward name describing the relationship from source to target
  • A backward name describing the relationship from target to source

The example below shows a ticket that is dependent on an issue. The backward name for the relationship "is dependency of" is shown in the reverse direction.

Supported object types

Links can be created between the following object types:

  • custom object
  • work (issue, ticket, task, opportunity)
  • account, user
  • part (product, capability, feature, enhancement)

For more details on customization or custom object concepts, please refer to the documentation below:

Every DevRev workspace is automatically provisioned with a set of default link types. These define the standard relationships between built-in object types, such as parent-child, related, dependency, and more. The default link types specify the allowed source and target object types, forward and backward names, and constraints for each relationship.

They are automatically created when a workspace is provisioned, and cannot be modified.

To retrieve the default link types for your workspace, use the list endpoint:

curl --location 'https://api.devrev.ai/link-types.custom.list' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{}'

Default link types are identified by is_default set to true in the response:

Response
{
    "custom_link_types": [
        {
            "id": "don:core:dvrv-us-1:devo/demo:custom_link_type/default-1",
            "name": "Parent Child",
            "forward_name": "Parent",
            "backward_name": "Child",
            "source_types": [{ "leaf_type": "ticket" }],
            "target_types": [{ "leaf_type": "ticket" }],
            "is_default": true
        }
    ]
}

Both default and user-created link types are managed through the same API endpoints (link-types.custom.*).

Let's say you want to establish a parent-child relationship between tickets and a custom object type called "Campaign". This relationship helps track which tickets are assigned to which campaigns.

To create this relationship, make an API call to create a link type:

curl --location 'https://api.devrev.ai/link-types.custom.create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "name": "Link between ticket and campaign",
    "source_types": [
        {
            "leaf_type": "ticket"
        }
    ],
    "target_types": [
        {
            "leaf_type": "campaign",
            "is_custom_leaf_type": true
        }
    ],
    "forward_name": "is parent of",
    "backward_name": "is child of"
}'

The link type above defines:

  • A descriptive name
  • Source types that the link can be created from (ticket)
  • Target types that the link can be created to (campaign custom object)
  • Forward name ("is parent of") describing the relationship from ticket to campaign
  • Backward name ("is child of") describing the relationship from campaign to ticket

A custom link type can have a maximum of 30 source types and 30 target types.

Once you have a link type (either a default or one you've created), you can create links between objects:

curl --location 'https://api.devrev.ai/links.create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "custom_link_type": "don:core:dvrv-us-1:devo/demo:custom_link_type/1",
    "source": "don:core:dvrv-us-1:devo/demo:ticket/1",
    "target": "don:core:dvrv-us-1:devo/demo:custom_object/campaign/1"
}'

When creating a link:

  1. Provide the link type ID in custom_link_type.
  2. Ensure both source and target objects exist.

The link_type enum field is deprecated. Use the link type ID (passed in custom_link_type) instead. This works for both default and user-created link types. The API remains backward compatible—requests using the link_type enum continue to work, but new integrations should use the link type ID.

When creating a link, you don't need to worry about which object to specify as the source and which as the target. The API automatically normalizes the direction to match the link type definition.

For example, if you create a "related to" link from a conversation to a ticket, the system resolves this against the corresponding default link type definition and creates the link from ticket to conversation. The link is still bidirectional—it can be traversed in both directions using the forward and backward names—but the stored state always adheres to the link type definition.

You can provide the source and target in any order when creating a link. The system ensures the link is stored consistently according to the link type definition.

You can list link types in your workspace, with optional filtering:

curl --location 'https://api.devrev.ai/link-types.custom.list' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "source_types_v2": [
        {
            "leaf_type": "ticket"
        }
    ]
}'

Now, you want to expand the source types to allow both issues and tickets to have this relationship with campaigns.

You can update the existing link type to include additional source types:

curl --location 'https://api.devrev.ai/link-types.custom.update' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "id": "don:core:dvrv-us-1:devo/demo:custom_link_type/1",
    "name": "Link type between issue/ticket and campaign",
    "source_types_v2": [
        {
            "leaf_type": "issue"
        },
        {
            "leaf_type": "ticket"
        }
    ]
}'

A custom link type can have a maximum of 30 source types and 30 target types.

You can restrict which objects are allowed in a link by using the subtype and leaf_only fields in the source or target type descriptors:

FieldTypeDescription
subtypestringRestricts the link to objects of a specific subtype.
leaf_onlybooleanWhen true, only objects of the exact leaf type are allowed (objects with any subtype are excluded). Defaults to false.

For example, you may want to only allow issues of a particular subtype to be linked to tickets.

curl --location 'https://api.devrev.ai/link-types.custom.create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "name": "Link between social media issues and tickets",
    "source_types": [
        {
            "leaf_type": "issue",
            "subtype": "social_media"
        }
    ],
    "target_types": [
        {
            "leaf_type": "ticket"
        }
    ],
    "forward_name": "is related to",
    "backward_name": "is related to"
}'

This configuration:

  • Allows issues of subtype "social_media" to be linked to tickets
  • Rejects attempts to link issues with no subtype or with other subtypes

The subtype must exist for the corresponding object type. To add more valid source subtypes, use the update endpoint to add them to the source_types_v2 array.

Link types cannot be deleted, only deprecated. This ensures that existing links maintain referential integrity and prevents data corruption.

To deprecate a link type, use the update endpoint and set is_deprecated to true:

curl --location 'https://api.devrev.ai/link-types.custom.update' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
    "id": "don:core:dvrv-us-1:devo/demo:custom_link_type/1",
    "is_deprecated": true
}'

This section lists the default link types available for tickets and issues. The diagrams show the stored direction as defined by the default link types. Because links are bidirectional, you can provide the objects in either order when making API calls. This is not an exhaustive list. To retrieve all available link types, use the list endpoint.

Link typeMultiple incoming to a targetMultiple outgoing from a sourceCycles allowedMax levels (depth)Where these limits matter most
is parent ofNoYesNo2Applies to ticket ↔ ticket and issue ↔ issue parent chains; also when parenting tasks
is related toYesYesYesNo fixed limitGeneral “related” networks are flexible
is merged intoYesNoNo2Ticket merges (ticket → ticket)
is follow up ofNoNoNoNo constraintConstraints are enforced only for ticket → ticket; outside that pair, constraints may not be checked
is dependent onYesYesYesNo fixed limitTicket → issue, issue → issue, issue → code change
is duplicate ofNo constraintNo constraintNo constraintNo constraintFor example, issue → issue; no additional constraints configured

Last updated on