Get target details by ID
POST/api/v2/workspace/:workspaceId/survey/:surveyCode/targets/details
Returns the definition and metadata of saved targets of a workspace: name, TGL expression, creation date and last update date.
Use it after GET /api/v2/workspace/{workspaceId}/survey/{surveyCode}/targets, which returns only ids and names, or after creating or updating a target, to read the expression as stored. POST is used only to send the list of ids in the body: the operation reads data, changes nothing and is safe to retry.
Before you call it
workspaceId: the workspace that contains the targets.ids: target ids, fromGET .../targets(nodes withtype: TARGET_VAR) or from theidreturned byPOST .../target.surveyCode: any survey code you can access, usually the workspace's own. It does not change the result.
Response
A JSON array with one Target per id that can be returned, in the order of ids (an id sent twice is returned twice).
| Field | Description |
|---|---|
id | Target id, as requested. |
label | Target name. |
filterTgl | The stored definition written as TGL (see the TGL guide). It is equivalent to the expression sent when the target was created or last updated, but can be written differently: parentheses are normalised, negations are pushed down to single conditions and OR groups can be distributed. Part labels (:'...') are not included. Omitted when the stored definition cannot be written as TGL. |
creationDate | When the target was created, as an ISO 8601 instant, for example 2026-05-27T10:15:30.123Z. |
updatedDate | When the target was last changed, same format. |
workspaceId is not returned by this operation.
Ids that are not returned
The request never fails because of a particular id: an id that cannot be returned is left out of the response without an error. This covers ids that do not exist, that belong to another workspace, or that belong to a workspace you cannot access. If no id can be returned, the response is 200 with []. Compare the returned id values with your request to find the missing ones. Send target ids only.
There is no fixed limit on the number of ids, but each id is resolved separately, so very large lists take longer.
Errors
| Status | errorCode | When |
|---|---|---|
| 400 | VAL_ERR_001 | ids is missing or empty, or the body is empty. |
| 400 | E400 | The body is not valid JSON. |
| 400 | AE_ERR_400 | The body is a JSON array, or a value has the wrong JSON type, such as a string in ids. The message names the field. |
| 400 | TW_ERR_500 | The X-API-Key value does not identify a TOM user. |
| 401 | E401 | The X-API-Key header is missing or empty. |
| 500 | GEN_ERR_500 | Unexpected error. |
Request
Responses
- 200
- 400
- 401
- 500
Details of the requested targets that can be returned, in request order. Ids that cannot be returned are left out.
ids is missing or empty, or the body is empty (VAL_ERR_001), or the body is not valid JSON (E400). AE_ERR_400: the body is a JSON array, or a value has the wrong JSON type. TW_ERR_500: the X-API-Key value does not identify a TOM user.
The X-API-Key header is missing or empty.
Unexpected error.