TwentyDEV icon

TwentyDEV

Consume the Twenty API

Actions252

Overview

This node interacts with the "Task Targets" resource of an API to retrieve multiple task target objects based on specified criteria. It is designed to fetch a list of task targets with flexible filtering, sorting, pagination, and depth control for nested related data.

Common scenarios where this node is beneficial include:

  • Retrieving a filtered list of task targets for reporting or dashboard purposes.
  • Fetching task targets sorted by specific fields to prioritize processing.
  • Paginating through large sets of task targets in batches.
  • Including related nested objects up to two levels deep to get comprehensive task target details in one request.

Practical example:

  • A user wants to get all active task targets excluding a default placeholder ID, sorted by creation date descending, limited to 50 results per call, including related user and project information (depth=2).

Properties

Name Meaning
Order By Sorts the returned task targets by specified fields. Format: field_name_1,field_name_2[DIRECTION_2],.... Directions can be AscNullsFirst, AscNullsLast, DescNullsFirst, DescNullsLast. Default direction is AscNullsFirst. Example: createdAt,priorityDescNullsLast
Filter Filters the returned task targets using field comparators. Format: field[COMPARATOR]:value. Supports complex filters with conjunctions (and, or, not). Comparators include eq, neq, in, containsAny, is, gt, gte, lt, lte, startsWith, like, ilike. Can filter nulls and booleans. Default excludes task targets with ID "00000000-0000-0000-0000-000000000000".
Limit Limits the number of task targets returned in one response. Default is 60.
Depth Controls how many levels of nested related objects are included in the response: 0 = only primary task target info, 1 = includes directly related objects, 2 = includes related objects of related objects. Default is 1.
Starting After Returns task targets starting after a specific cursor value, used for pagination. Cursor values come from startCursor or endCursor in the response's pageInfo.
Ending Before Returns task targets ending before a specific cursor value, used for pagination. Cursor values come from startCursor or endCursor in the response's pageInfo.

Output

The node outputs JSON data containing an array of task target objects matching the query parameters. Each object includes fields of the task target and, depending on the Depth parameter, nested related objects up to two levels deep.

If the API supports binary data for task targets (not indicated here), it would be included as binary output; otherwise, the output is purely JSON.

Typical output structure:

{
  "data": [
    {
      "id": "string",
      "name": "string",
      "status": "string",
      "relatedObject": { ... },        // Included if depth >= 1
      "relatedObjectNested": { ... }   // Included if depth == 2
      // other task target fields
    }
    // more task targets
  ],
  "pageInfo": {
    "startCursor": "string",
    "endCursor": "string",
    "hasNextPage": true,
    "hasPreviousPage": false
  }
}

Dependencies

  • Requires an API key credential or similar authentication token configured in n8n to access the Twenty API.
  • The base URL for the API is set dynamically from credentials.
  • No additional external dependencies beyond the API service.

Troubleshooting

  • Empty results: Check that your filter syntax is correct and matches existing data. Also verify pagination cursors if using starting_after or ending_before.
  • Invalid filter or order_by format: Ensure filters and sort strings follow the documented syntax exactly, including comparator names and directions.
  • Authentication errors: Confirm that the API key or token credential is valid and has sufficient permissions.
  • Pagination issues: If cursors are invalid or expired, reset pagination parameters.
  • Depth too high: Requesting depth > 2 may not be supported and could cause errors or incomplete data.

Links and References

  • Twenty API Documentation (hypothetical link)
  • Filtering and Sorting Syntax Guide (refer to API docs for detailed examples)
  • Pagination Concepts in APIs (cursor-based pagination explanation)

Discussion