Syncless

Tasks

List tasks

Lists tasks owned by the API key user in a project. Use project_id personal to list Personal tasks.

GET /api/console/v1/projects/<project_id>/tasks?index=0&pageSize=50
Authorization: Bearer <api_key>
GET /api/console/v1/projects/personal/tasks?index=0&pageSize=50
Authorization: Bearer <api_key>

Response

{
  "tasks": [
    {
      "id": "<task_id>",
      "title": "Draft a launch checklist."
    }
  ]
}

Examples

TypeScript

const BASE_URL = "https://api.syncless.ai"
const API_KEY = "<api_key>"
const PROJECT_ID = "<project_id>"

const projectTasks = await fetch(BASE_URL + "/api/console/v1/projects/" + PROJECT_ID + "/tasks?index=0&pageSize=50", {
  headers: {
    "Authorization": "Bearer " + API_KEY,
  },
})

if (!projectTasks.ok) {
  throw new Error(await projectTasks.text())
}

console.log(await projectTasks.json())

const personalTasks = await fetch(BASE_URL + "/api/console/v1/projects/personal/tasks?index=0&pageSize=50", {
  headers: {
    "Authorization": "Bearer " + API_KEY,
  },
})

if (!personalTasks.ok) {
  throw new Error(await personalTasks.text())
}

console.log(await personalTasks.json())

Python

import requests

BASE_URL = "https://api.syncless.ai"
API_KEY = "<api_key>"
PROJECT_ID = "<project_id>"

project_tasks = requests.get(
    BASE_URL + "/api/console/v1/projects/" + PROJECT_ID + "/tasks?index=0&pageSize=50",
    headers={
        "Authorization": "Bearer " + API_KEY,
    },
)
project_tasks.raise_for_status()
print(project_tasks.json())

personal_tasks = requests.get(
    BASE_URL + "/api/console/v1/projects/personal/tasks?index=0&pageSize=50",
    headers={
        "Authorization": "Bearer " + API_KEY,
    },
)
personal_tasks.raise_for_status()
print(personal_tasks.json())

cURL

curl "https://api.syncless.ai/api/console/v1/projects/<project_id>/tasks?index=0&pageSize=50" \
  -H "Authorization: Bearer <api_key>"

curl "https://api.syncless.ai/api/console/v1/projects/personal/tasks?index=0&pageSize=50" \
  -H "Authorization: Bearer <api_key>"

Create a project task

Creates a task in a standard project and sends the first prompt immediately. Set upstream_task_id to create the task downstream of an existing task in the same project; omit it to create a root task.

POST /api/console/v1/projects/<project_id>/tasks
Authorization: Bearer <api_key>
Content-Type: application/json

Request body

{
  "blocks": [
    { "type": "text", "text": "Draft a launch checklist." }
  ],
  "upstream_task_id": "<optional_upstream_task_id>"
}
{
  "blocks": [
    { "type": "text", "text": "Draft a root task." }
  ]
}

Response

{
  "ok": true,
  "task": {
    "id": "<task_id>",
    "title": "Draft a launch checklist.",
    "upstreamTaskId": "<upstream_task_id>"
  }
}

Examples

TypeScript

const BASE_URL = "https://api.syncless.ai"
const API_KEY = "<api_key>"
const PROJECT_ID = "<project_id>"

const response = await fetch(BASE_URL + "/api/console/v1/projects/" + PROJECT_ID + "/tasks", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    blocks: [
      { type: "text", text: "Draft a launch checklist." },
    ],
    upstream_task_id: "<upstream_task_id>",
  }),
})

if (!response.ok) {
  throw new Error(await response.text())
}

console.log(await response.json())

Python

import json
import requests

BASE_URL = "https://api.syncless.ai"
API_KEY = "<api_key>"
PROJECT_ID = "<project_id>"

body = json.dumps({
    "blocks": [
        {"type": "text", "text": "Draft a launch checklist."},
    ],
    "upstream_task_id": "<upstream_task_id>",
}).encode("utf-8")

response = requests.post(
    BASE_URL + "/api/console/v1/projects/" + PROJECT_ID + "/tasks",
    data=body,
    headers={
        "Authorization": "Bearer " + API_KEY,
        "Content-Type": "application/json",
    },
)

response.raise_for_status()
print(response.json())

cURL

curl -X POST "https://api.syncless.ai/api/console/v1/projects/<project_id>/tasks" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "blocks": [
      { "type": "text", "text": "Draft a launch checklist." }
    ],
    "upstream_task_id": "<upstream_task_id>"
  }'

Get a task

Gets one task owned by the API key user in the active workspace.

GET /api/console/v1/tasks/<task_id>
Authorization: Bearer <api_key>

Response

{
  "task": {
    "id": "<task_id>",
    "title": "Draft a launch checklist."
  }
}

Examples

TypeScript

const BASE_URL = "https://api.syncless.ai"
const API_KEY = "<api_key>"
const TASK_ID = "<task_id>"

const response = await fetch(BASE_URL + "/api/console/v1/tasks/" + TASK_ID, {
  headers: {
    "Authorization": "Bearer " + API_KEY,
  },
})

if (!response.ok) {
  throw new Error(await response.text())
}

console.log(await response.json())

Python

import requests

BASE_URL = "https://api.syncless.ai"
API_KEY = "<api_key>"
TASK_ID = "<task_id>"

response = requests.get(
    BASE_URL + "/api/console/v1/tasks/" + TASK_ID,
    headers={
        "Authorization": "Bearer " + API_KEY,
    },
)

response.raise_for_status()
print(response.json())

cURL

curl "https://api.syncless.ai/api/console/v1/tasks/<task_id>" \
  -H "Authorization: Bearer <api_key>"

List task messages

Lists historical messages for one task owned by the API key user. The limit is capped at 20.

GET /api/console/v1/tasks/<task_id>/messages?limit=20
Authorization: Bearer <api_key>

Response

{
  "ok": true,
  "taskId": "<task_id>",
  "messages": []
}

Examples

TypeScript

const BASE_URL = "https://api.syncless.ai"
const API_KEY = "<api_key>"
const TASK_ID = "<task_id>"

const response = await fetch(BASE_URL + "/api/console/v1/tasks/" + TASK_ID + "/messages?limit=20", {
  headers: {
    "Authorization": "Bearer " + API_KEY,
  },
})

if (!response.ok) {
  throw new Error(await response.text())
}

console.log(await response.json())

Python

import requests

BASE_URL = "https://api.syncless.ai"
API_KEY = "<api_key>"
TASK_ID = "<task_id>"

response = requests.get(
    BASE_URL + "/api/console/v1/tasks/" + TASK_ID + "/messages?limit=20",
    headers={
        "Authorization": "Bearer " + API_KEY,
    },
)

response.raise_for_status()
print(response.json())

cURL

curl "https://api.syncless.ai/api/console/v1/tasks/<task_id>/messages?limit=20" \
  -H "Authorization: Bearer <api_key>"

Send a prompt to a task

Sends a text prompt to an existing task and returns immediately. If the task is already running, the API returns 400 with code TASK_RUNNING.

POST /api/console/v1/tasks/<task_id>/send
Authorization: Bearer <api_key>
Content-Type: application/json

Request body

[
  { "type": "text", "text": "Continue with the implementation plan." }
]

Response

{ "ok": true }

Running task error

{
  "error": "Task is currently running",
  "details": {
    "code": "TASK_RUNNING"
  }
}

Examples

TypeScript

const BASE_URL = "https://api.syncless.ai"
const API_KEY = "<api_key>"
const TASK_ID = "<task_id>"

const response = await fetch(BASE_URL + "/api/console/v1/tasks/" + TASK_ID + "/send", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify([
    { type: "text", text: "Continue with the implementation plan." },
  ]),
})

if (!response.ok) {
  throw new Error(await response.text())
}

console.log(await response.json())

Python

import json
import requests

BASE_URL = "https://api.syncless.ai"
API_KEY = "<api_key>"
TASK_ID = "<task_id>"

body = json.dumps([
    {"type": "text", "text": "Continue with the implementation plan."},
]).encode("utf-8")

response = requests.post(
    BASE_URL + "/api/console/v1/tasks/" + TASK_ID + "/send",
    data=body,
    headers={
        "Authorization": "Bearer " + API_KEY,
        "Content-Type": "application/json",
    },
)

response.raise_for_status()
print(response.json())

cURL

curl -X POST "https://api.syncless.ai/api/console/v1/tasks/<task_id>/send" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '[
    { "type": "text", "text": "Continue with the implementation plan." }
  ]'