import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.tasks.createTask({
title: 'Call back the customer about the renewal quote',
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/tasks/create' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"title": "Call back the customer about the renewal quote"
}'{
"task_id": "task-aaaaaaaaaaaa",
"title": "Call back the customer about the renewal quote",
"type": "message",
"status": "open",
"priority": 2,
"assignee": "user@example.com",
"created_by": "api",
"last_updated_by": "api",
"created_at": "2026-01-15T09:30:00.000Z",
"last_updated_at": "2026-01-15T09:30:00.000Z",
"due_date": "2026-01-20T17:00:00.000Z",
"remind_at": "2026-01-20T09:00:00.000Z",
"notes": "Customer prefers a call after 3pm IST",
"chat_id": "120363000000000000@g.us",
"association": {
"type": "message",
"chat_id": "120363000000000000@g.us",
"message_id": "false_120363000000000000@g.us_AAAAAAAAAAAAAAAAAAAA",
"ticket_id": "ACM-042"
},
"completed_metadata": {
"completed_at": "2026-01-21T10:15:00.000Z",
"completed_by": "user@example.com"
}
}{
"code": "UNAUTHORIZED_ERROR",
"message": "Invalid bearer auth token",
"status": 401
}{
"code": "NOT_FOUND_ERROR",
"message": "The chat, message or ticket referenced in association does not exist in the workspace",
"status": 404
}{
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"status": 422,
"fields": {
"body.chat_id": {
"message": "chat_id is required"
}
}
}{
"code": "RATE_LIMIT_ERROR",
"message": "You can only make 100 requests per second",
"status": 429
}{
"code": "UNKNOWN_ERROR",
"message": "Internal server error",
"status": 500
}Create Task
Creates a task — standalone (type: todo, default) or linked to a chat, message or ticket via type and the matching id.
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.tasks.createTask({
title: 'Call back the customer about the renewal quote',
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/tasks/create' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"title": "Call back the customer about the renewal quote"
}'{
"task_id": "task-aaaaaaaaaaaa",
"title": "Call back the customer about the renewal quote",
"type": "message",
"status": "open",
"priority": 2,
"assignee": "user@example.com",
"created_by": "api",
"last_updated_by": "api",
"created_at": "2026-01-15T09:30:00.000Z",
"last_updated_at": "2026-01-15T09:30:00.000Z",
"due_date": "2026-01-20T17:00:00.000Z",
"remind_at": "2026-01-20T09:00:00.000Z",
"notes": "Customer prefers a call after 3pm IST",
"chat_id": "120363000000000000@g.us",
"association": {
"type": "message",
"chat_id": "120363000000000000@g.us",
"message_id": "false_120363000000000000@g.us_AAAAAAAAAAAAAAAAAAAA",
"ticket_id": "ACM-042"
},
"completed_metadata": {
"completed_at": "2026-01-21T10:15:00.000Z",
"completed_by": "user@example.com"
}
}{
"code": "UNAUTHORIZED_ERROR",
"message": "Invalid bearer auth token",
"status": 401
}{
"code": "NOT_FOUND_ERROR",
"message": "The chat, message or ticket referenced in association does not exist in the workspace",
"status": 404
}{
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"status": 422,
"fields": {
"body.chat_id": {
"message": "chat_id is required"
}
}
}{
"code": "RATE_LIMIT_ERROR",
"message": "You can only make 100 requests per second",
"status": 429
}{
"code": "UNKNOWN_ERROR",
"message": "Internal server error",
"status": 500
}Authorizations
Your Periskope API token, sent as Authorization: Bearer <token>. Generate one from the Periskope dashboard under Settings → API & Webhooks. API access requires an active Pro or Enterprise plan.
Body
Title of the task, up to 500 characters
1 - 500"Call back the customer about the renewal quote"
Kind of task: 'todo' for a standalone task (the default when omitted or null), or 'chat', 'message' or 'ticket' for a task linked to that object. Determines which id association must carry. Immutable after creation.
todo, chat, message, ticket, null "message"
Links the task to its parent object. Required when type is 'chat', 'message' or 'ticket' and must then contain exactly one key — the one matching the type (association.chat_id, association.message_id or association.ticket_id). Must be omitted for todo tasks. Immutable after creation.
Show child attributes
Show child attributes
{
"message_id": "false_120363000000000000@g.us_AAAAAAAAAAAAAAAAAAAA"
}
Initial status of the task: 'open', 'inprogress' or 'closed'. Defaults to 'open' when omitted or null. Creating a task as 'closed' records completed_metadata with the completion time and actor.
open, inprogress, closed, null "open"
Priority of the task: 1 (low), 2 (medium) or 3 (high). Accepts a number or a numeric string. Defaults to 1 when omitted or null.
1 <= x <= 32
Email of the workspace member to assign the task to. Must match an existing member of the workspace, otherwise the request is rejected. Defaults to unassigned.
"user@example.com"
When the task is due, as an ISO 8601 timestamp (other common date formats are accepted and normalized to UTC ISO 8601). Defaults to no due date.
"2026-01-20T17:00:00Z"
Free-form notes to store on the task
"Customer prefers a call after 3pm IST"
When to fire a reminder for the task, as an ISO 8601 timestamp (other common date formats are accepted and normalized to UTC ISO 8601). Defaults to no reminder.
"2026-01-20T09:00:00Z"
Email of the workspace member to record as the creator (also recorded as last_updated_by). Must match an existing member of the workspace. Defaults to "api".
"user@example.com"
Response
The created task
A task in the workspace. Tasks are either standalone to-dos (type: todo) or linked to a chat, message or ticket via association. Tasks belong to the workspace as a whole, not to a specific phone.
Unique id of the task (task-xxxxxxxxxxxxxxxx). Use this value as the task_id path parameter when fetching or updating the task.
"task-aaaaaaaaaaaa"
Title of the task, up to 500 characters
"Call back the customer about the renewal quote"
Kind of task: 'todo' for a standalone task, or 'chat', 'message' or 'ticket' for a task linked to that object. Immutable after creation.
todo, chat, message, ticket "message"
Lifecycle status of the task: 'open', 'inprogress' or 'closed'
open, inprogress, closed "open"
Priority of the task: 1 (low), 2 (medium) or 3 (high)
2
Email of the workspace member the task is assigned to. null when the task is unassigned.
"user@example.com"
Who created the task: a member's email, or "api" when created via the API without a created_by
"api"
Who last changed the task: a member's email, or "api" for API changes without a last_updated_by
"api"
When the task was created, as an ISO 8601 timestamp
"2026-01-15T09:30:00.000Z"
When the task was last updated, as an ISO 8601 timestamp
"2026-01-15T09:30:00.000Z"
When the task is due, as an ISO 8601 UTC timestamp. null when no due date is set.
"2026-01-20T17:00:00.000Z"
When a reminder for the task fires, as an ISO 8601 UTC timestamp. null when no reminder is set.
"2026-01-20T09:00:00.000Z"
Free-form notes on the task. null when none were set.
"Customer prefers a call after 3pm IST"
Id of the chat the task is linked to (directly, or through its message or ticket). null for todo tasks.
"120363000000000000@g.us"
The chat, message or ticket the task is linked to. null for todo tasks.
Show child attributes
Show child attributes
Completion details, recorded when the task moves to status 'closed' and cleared when it is reopened. null while the task is open or inprogress.
Show child attributes
Show child attributes
Was this page helpful?