Dependencies

Link records into blocking relationships, change a dependency's direction, or remove it with the dependency mutations.


Dependencies link two records into a blocking relationship — one record blocks another, or is blocked by it. Records are Record objects in the API, so these mutations operate on todo IDs.

Use createRecordDependency to link two records, updateRecordDependency to flip the direction of an existing link, and deleteRecordDependency to remove it. Each pair of records can have at most one dependency. To read existing dependencies back, select the dependOn and dependBy fields on a Record (see Reading dependencies).

Request

Create a dependency where one record blocks another:

mutation CreateDependency {
  createRecordDependency(input: { type: BLOCKING, todoId: "todo_123", otherTodoId: "todo_456" }) {
    id
    title
  }
}

With type: BLOCKING, todoId blocks otherTodoId — the other record can’t proceed until this one is done.

Parameters

CreateRecordDependencyInput

ParameterTypeRequiredDescription
typeTodoDependencyType!YesDirection of the relationship — BLOCKING or BLOCKED_BY.
todoIdString!YesID of the primary record.
otherTodoIdString!YesID of the other record in the relationship.

UpdateRecordDependencyInput

ParameterTypeRequiredDescription
typeTodoDependencyType!YesNew direction for the existing dependency.
todoIdString!YesID of the primary record.
otherTodoIdString!YesID of the other record in the relationship.

DeleteRecordDependencyInput

ParameterTypeRequiredDescription
todoIdString!YesID of the primary record.
otherTodoIdString!YesID of the other record in the relationship.

Deleting a dependency needs only the two record IDs — direction is not specified, and the order of todoId and otherTodoId does not matter.

TodoDependencyType

ValueDescription
BLOCKINGThe primary record (todoId) blocks the other record (otherTodoId). The other record can’t proceed until the primary is done.
BLOCKED_BYThe primary record (todoId) is blocked by the other record (otherTodoId). The primary can’t proceed until the other is done.

Response

createRecordDependency and updateRecordDependency return the primary record (the Record named in todoId). For the request above:

{
  "data": {
    "createRecordDependency": {
      "id": "clm4n8qwx000008l0g4oxdqn7",
      "title": "Ship the API docs"
    }
  }
}

deleteRecordDependency returns a Booleantrue when the dependency was removed.

{
  "data": {
    "deleteRecordDependency": true
  }
}

Returns (createRecordDependency / updateRecordDependency)

Both mutations return the primary Record. Commonly selected fields:

FieldTypeDescription
idID!Unique identifier for the record.
uidString!Short, human-readable record identifier.
titleString!Record title.
doneBoolean!Whether the record is complete.
startedAtDateTimeStart date/time, if set.
duedAtDateTimeDue date/time, if set.
todoListRecordList!The list the record belongs to.
users[User!]!Assigned users.
tags[Tag!]!Tags on the record.
dependOn[Record!]Records this record depends on (is blocked by).
dependBy[Record!]Records that depend on this record (it blocks).

Full example

Flip a dependency’s direction, then remove it. updateRecordDependency targets the pair (todoId, otherTodoId) regardless of how it was originally created and changes its direction; setting it to the direction it already has is a no-op that returns the record without logging activity.

# Reverse the relationship: now todo_123 is blocked by todo_456
mutation FlipDependency {
  updateRecordDependency(input: { type: BLOCKED_BY, todoId: "todo_123", otherTodoId: "todo_456" }) {
    id
    title
    dependOn {
      id
      title
    }
  }
}

# Remove the dependency entirely
mutation RemoveDependency {
  deleteRecordDependency(input: { todoId: "todo_123", otherTodoId: "todo_456" })
}

Reading dependencies

There is no dedicated dependency query. Read a record’s links back through the dependOn and dependBy fields on the Record itself, available wherever you select a record (for example via List records):

query RecordDependencies {
  recordQueries {
    todos(filter: { companyIds: ["company_123"], todoListIds: ["list_123"] }) {
      items {
        id
        title
        dependOn {
          id
          title
        }
        dependBy {
          id
          title
        }
      }
    }
  }
}

dependOn lists the records this record is blocked by; dependBy lists the records it blocks.

Errors

CodeWhen
TODO_NOT_FOUNDEither todoId or otherTodoId does not exist or is not accessible. Also returned by deleteRecordDependency when no dependency exists between the two records.
TODO_DEPENDENCY_ALREADY_EXISTScreateRecordDependency was called for a pair that already has a dependency. Use updateRecordDependency to change an existing link’s direction.

Permissions

Managing dependencies requires edit access to the record’s dependency field. Per the resolver (editDependencyOrThrow), OWNER, ADMIN, and MEMBER can create, update, and delete dependencies; CLIENT, COMMENT_ONLY, and VIEW_ONLY cannot. When the caller has a custom role, that role must grant the DEPENDENCY field permission.