Skip to content

AsyncTasksAPI

Defined in: src/api/asyncTasks.api.ts:24

Async Tasks API client for polling long-running Notion operations.

new AsyncTasksAPI(client): AsyncTasksAPI

Defined in: src/api/asyncTasks.api.ts:30

NotionClient

AsyncTasksAPI

BaseAPI<NotionAsyncTask, AsyncTask>.constructor

poll(taskId, options?): Promise<AsyncTask>

Defined in: src/api/asyncTasks.api.ts:57

Poll an async task until it reaches a terminal status: succeeded or failed. Wait at least poll_after_seconds between each poll, per the API’s guidance. This value comes from the response body, not a header.

string

The ID of the async task to poll

PollAsyncTaskOptions

Polling options

Promise<AsyncTask>

The task wrapped in an AsyncTask model, once it reaches a terminal status

If the task doesn’t complete within timeoutMs


retrieve(taskId): Promise<AsyncTask>

Defined in: src/api/asyncTasks.api.ts:42

Retrieve the current status of an async task.

string

The ID of the async task to retrieve

Promise<AsyncTask>

The task wrapped in an AsyncTask model

https://developers.notion.com/reference/retrieve-async-task