TypeScript SDK
import assert from "node:assert/strict";
import { createClient } from "@toloka-platform/sdk";
const client = createClient({
baseUrl: "https://platform.toloka.ai",
apiKey: process.env.TOLOKA_API_KEY!,
});
const snapshot = await client.pipelines.getGraph({ pipelineId: "pl.019a0000-0000-7000-8000-000000000001" });
const graph = structuredClone(snapshot.graph);
const root = graph.nodes.find((node) => node.type === "root");
assert(root, "The pipeline has no Start node.");
root.settings.itemLimit = 100;
const pipeline = await client.pipelines.replaceGraph({
pipelineId: "pl.019a0000-0000-7000-8000-000000000001",
graph: graph,
expectedVersion: snapshot.version
});
console.log(pipeline);
curl --request PUT \
--url https://platform.toloka.ai/api/v2-beta/pipelines/{pipelineId}/graph \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"graph": {
"connections": [
{
"from": {
"handle": "<string>",
"node": "<string>"
},
"settings": {},
"to": {
"handle": "<string>",
"node": "<string>"
}
}
],
"fields": [
{
"id": "<string>",
"jsonSchema": {
"additionalProperties": true,
"allOf": [
"<unknown>"
],
"anyOf": [
"<unknown>"
],
"const": "<string>",
"default": "<string>",
"description": "<string>",
"enum": [
"<string>"
],
"examples": [
"<string>"
],
"exclusiveMaximum": 123,
"exclusiveMinimum": 123,
"format": "<string>",
"items": "<unknown>",
"maxItems": 4503599627370495,
"maxLength": 4503599627370495,
"maximum": 123,
"minItems": 4503599627370495,
"minLength": 4503599627370495,
"minimum": 123,
"oneOf": [
"<unknown>"
],
"pattern": "<string>",
"properties": {},
"required": [
"<string>"
],
"title": "<string>",
"uniqueItems": true
},
"name": "<string>"
}
],
"nodes": [
{
"id": "<string>",
"settings": {
"completedFieldProxies": {
"input": [
{
"id": "<string>",
"optional": true
}
]
},
"startedFieldProxies": {
"output": [
{
"id": "<string>",
"optional": true
}
]
},
"datasetId": "<string>",
"itemFilter": {
"createdBefore": "2023-11-07T05:31:56Z",
"excludeParts": [
{
"fieldId": "<string>",
"names": [
"<string>"
]
}
],
"fieldSources": [
{
"fieldId": "<string>",
"sources": [
{
"type": "user",
"userId": "<string>"
}
]
}
],
"fieldValues": [
{
"fieldId": "<string>",
"jsonPath": "<string>",
"value": "<string>",
"latestOnly": true,
"sources": []
}
],
"missingRevisionFields": [
"<string>"
]
},
"itemLimit": 123
},
"type": "root"
}
],
"version": 1,
"layout": {}
}
}
'import requests
url = "https://platform.toloka.ai/api/v2-beta/pipelines/{pipelineId}/graph"
payload = { "graph": {
"connections": [
{
"from": {
"handle": "<string>",
"node": "<string>"
},
"settings": {},
"to": {
"handle": "<string>",
"node": "<string>"
}
}
],
"fields": [
{
"id": "<string>",
"jsonSchema": {
"additionalProperties": True,
"allOf": ["<unknown>"],
"anyOf": ["<unknown>"],
"const": "<string>",
"default": "<string>",
"description": "<string>",
"enum": ["<string>"],
"examples": ["<string>"],
"exclusiveMaximum": 123,
"exclusiveMinimum": 123,
"format": "<string>",
"items": "<unknown>",
"maxItems": 4503599627370495,
"maxLength": 4503599627370495,
"maximum": 123,
"minItems": 4503599627370495,
"minLength": 4503599627370495,
"minimum": 123,
"oneOf": ["<unknown>"],
"pattern": "<string>",
"properties": {},
"required": ["<string>"],
"title": "<string>",
"uniqueItems": True
},
"name": "<string>"
}
],
"nodes": [
{
"id": "<string>",
"settings": {
"completedFieldProxies": { "input": [
{
"id": "<string>",
"optional": True
}
] },
"startedFieldProxies": { "output": [
{
"id": "<string>",
"optional": True
}
] },
"datasetId": "<string>",
"itemFilter": {
"createdBefore": "2023-11-07T05:31:56Z",
"excludeParts": [
{
"fieldId": "<string>",
"names": ["<string>"]
}
],
"fieldSources": [
{
"fieldId": "<string>",
"sources": [
{
"type": "user",
"userId": "<string>"
}
]
}
],
"fieldValues": [
{
"fieldId": "<string>",
"jsonPath": "<string>",
"value": "<string>",
"latestOnly": True,
"sources": []
}
],
"missingRevisionFields": ["<string>"]
},
"itemLimit": 123
},
"type": "root"
}
],
"version": 1,
"layout": {}
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"createdAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"name": "<string>",
"projectId": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"version": 123
}Pipeline graph
Replace the pipeline graph
Send the complete graph, up to 2 MiB, and optionally expectedVersion. Returns the updated pipeline metadata. Invalid configuration or missing secrets returns 400; failed checks and lint findings do not block this write. An attached dataset cannot be removed. A stale version, concurrent edit, or active run returns 409; read the graph again before retrying.
PUT
/
pipelines
/
{pipelineId}
/
graph
TypeScript SDK
import assert from "node:assert/strict";
import { createClient } from "@toloka-platform/sdk";
const client = createClient({
baseUrl: "https://platform.toloka.ai",
apiKey: process.env.TOLOKA_API_KEY!,
});
const snapshot = await client.pipelines.getGraph({ pipelineId: "pl.019a0000-0000-7000-8000-000000000001" });
const graph = structuredClone(snapshot.graph);
const root = graph.nodes.find((node) => node.type === "root");
assert(root, "The pipeline has no Start node.");
root.settings.itemLimit = 100;
const pipeline = await client.pipelines.replaceGraph({
pipelineId: "pl.019a0000-0000-7000-8000-000000000001",
graph: graph,
expectedVersion: snapshot.version
});
console.log(pipeline);
curl --request PUT \
--url https://platform.toloka.ai/api/v2-beta/pipelines/{pipelineId}/graph \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"graph": {
"connections": [
{
"from": {
"handle": "<string>",
"node": "<string>"
},
"settings": {},
"to": {
"handle": "<string>",
"node": "<string>"
}
}
],
"fields": [
{
"id": "<string>",
"jsonSchema": {
"additionalProperties": true,
"allOf": [
"<unknown>"
],
"anyOf": [
"<unknown>"
],
"const": "<string>",
"default": "<string>",
"description": "<string>",
"enum": [
"<string>"
],
"examples": [
"<string>"
],
"exclusiveMaximum": 123,
"exclusiveMinimum": 123,
"format": "<string>",
"items": "<unknown>",
"maxItems": 4503599627370495,
"maxLength": 4503599627370495,
"maximum": 123,
"minItems": 4503599627370495,
"minLength": 4503599627370495,
"minimum": 123,
"oneOf": [
"<unknown>"
],
"pattern": "<string>",
"properties": {},
"required": [
"<string>"
],
"title": "<string>",
"uniqueItems": true
},
"name": "<string>"
}
],
"nodes": [
{
"id": "<string>",
"settings": {
"completedFieldProxies": {
"input": [
{
"id": "<string>",
"optional": true
}
]
},
"startedFieldProxies": {
"output": [
{
"id": "<string>",
"optional": true
}
]
},
"datasetId": "<string>",
"itemFilter": {
"createdBefore": "2023-11-07T05:31:56Z",
"excludeParts": [
{
"fieldId": "<string>",
"names": [
"<string>"
]
}
],
"fieldSources": [
{
"fieldId": "<string>",
"sources": [
{
"type": "user",
"userId": "<string>"
}
]
}
],
"fieldValues": [
{
"fieldId": "<string>",
"jsonPath": "<string>",
"value": "<string>",
"latestOnly": true,
"sources": []
}
],
"missingRevisionFields": [
"<string>"
]
},
"itemLimit": 123
},
"type": "root"
}
],
"version": 1,
"layout": {}
}
}
'import requests
url = "https://platform.toloka.ai/api/v2-beta/pipelines/{pipelineId}/graph"
payload = { "graph": {
"connections": [
{
"from": {
"handle": "<string>",
"node": "<string>"
},
"settings": {},
"to": {
"handle": "<string>",
"node": "<string>"
}
}
],
"fields": [
{
"id": "<string>",
"jsonSchema": {
"additionalProperties": True,
"allOf": ["<unknown>"],
"anyOf": ["<unknown>"],
"const": "<string>",
"default": "<string>",
"description": "<string>",
"enum": ["<string>"],
"examples": ["<string>"],
"exclusiveMaximum": 123,
"exclusiveMinimum": 123,
"format": "<string>",
"items": "<unknown>",
"maxItems": 4503599627370495,
"maxLength": 4503599627370495,
"maximum": 123,
"minItems": 4503599627370495,
"minLength": 4503599627370495,
"minimum": 123,
"oneOf": ["<unknown>"],
"pattern": "<string>",
"properties": {},
"required": ["<string>"],
"title": "<string>",
"uniqueItems": True
},
"name": "<string>"
}
],
"nodes": [
{
"id": "<string>",
"settings": {
"completedFieldProxies": { "input": [
{
"id": "<string>",
"optional": True
}
] },
"startedFieldProxies": { "output": [
{
"id": "<string>",
"optional": True
}
] },
"datasetId": "<string>",
"itemFilter": {
"createdBefore": "2023-11-07T05:31:56Z",
"excludeParts": [
{
"fieldId": "<string>",
"names": ["<string>"]
}
],
"fieldSources": [
{
"fieldId": "<string>",
"sources": [
{
"type": "user",
"userId": "<string>"
}
]
}
],
"fieldValues": [
{
"fieldId": "<string>",
"jsonPath": "<string>",
"value": "<string>",
"latestOnly": True,
"sources": []
}
],
"missingRevisionFields": ["<string>"]
},
"itemLimit": 123
},
"type": "root"
}
],
"version": 1,
"layout": {}
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"createdAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"name": "<string>",
"projectId": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"version": 123
}Authorizations
apiKeyAuthscopedTokenAuth
Path Parameters
Body
application/json
Response
Pipeline graph replaced
A pipeline within a project.
Time the pipeline was created, as an ISO 8601 timestamp.
Pattern:
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$Time the pipeline was last updated, as an ISO 8601 timestamp.
Pattern:
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$Was this page helpful?