Skip to content
DocsRequests API

Theme

Requests API

Every /v1/requests endpoint: list the Requests of this Project, create a Request, read a Request, withdraw a Request, re-notify a pending Request, await the outcome of a Request.

Base URL: https://api.nibify.app.

List the Requests of this Project

GET/v1/requests

Every Request this key can see, newest first — the answer to "what did I leave hanging" for an agent that was switched off and lost the ids it was holding. Narrow with status (pending is the one that question wants), with threadKey, and with createdAfter/createdBefore, both exclusive. Rows are the same Request GET /v1/requests/{id} returns, response included, so a settled page needs no second call. Notifications sent with no question attached are not Requests and are not here. The list is scoped to the half of the Project the key belongs to: an sk_test_… never sees a live Request, and no key ever sees another Project.

Headers

Headers
FieldDescription
Authorizationstring · requiredBearer sk_test_…: an API key of your project.

Query parameters

Query parameters
FieldDescription
statusstringOnly the Requests in this status. One of pending, answered, expired, dismissed, cancelled.
threadKeystringOnly the Requests of the Thread with this key. Not empty.
createdAfterstringOnly the Requests created after this instant, not at it. An RFC 3339 timestamp.
createdBeforestringOnly the Requests created before this instant, not at it. An RFC 3339 timestamp.
limitintegerHow many Requests a page holds. Between 1 and 100. Defaults to 30.
cursorstringThe nextCursor of the previous page. Omit it for the first page. Not empty.

Responses

Responses
StatusDescription
200One page, newest first, and the cursor for the next one.
401unauthorized for a missing or unusable key, api_key_revoked for a revoked one.
422invalid_request_body. limit must be between 1 and 100; cursor must be a nextCursor this endpoint returned; createdAfter and createdBefore must be RFC 3339 timestamps.
429rate_limited. This project is over its requests-per-second ceiling or its daily volume in the environment this key speaks for; the message says which of the two it was. The budget is the project’s and not the key’s, so another API key of the same project shares it — the test and live halves are counted apart. Nothing was created and nothing was counted: retrying after Retry-After is safe. Header Retry-After: how many seconds to wait before retrying. Always a whole number, never below 1.

Response body, 200

Response body, 200
FieldDescription
itemsarray of objects · requiredThe Requests of this page, newest first.
items[].requestIdstring · requiredThe Request’s id.
items[].statusstring · requiredWhere the Request is: pending until it reaches one of the four terminal states. One of pending, answered, expired, dismissed, cancelled.
items[].createdAtstring · requiredWhen the Request was created. An RFC 3339 timestamp.
items[].expiresAtstring or null · requiredWhen the Request expires, or null if it never does. An RFC 3339 timestamp.
items[].environmentstring · requiredThe Environment of the API key that created it. One of test, live.
items[].deliveredAtstring or null · requiredWhen a phone of the recipient first confirmed the push arrived. Null means not confirmed yet, not that it was not sent. An RFC 3339 timestamp.
items[].readAtstring or null · requiredWhen the person first opened it, or null. Never set while deliveredAt is not. An RFC 3339 timestamp.
items[].contentDeletedAtstring or null · requiredWhen the person deleted what was said in this Request, or null. From then on response.context is null. An RFC 3339 timestamp.
items[].responseobject or null · requiredThe person’s answer: present exactly when status is answered.
items[].response.responseIdstring · requiredThe Response’s id.
items[].response.actionNamestring · requiredThe action the person chose.
items[].response.sourceComponentIdstring · requiredThe id of the component the person answered with, or notification for a quick action on the push.
items[].response.contextobject or null · requiredThe values the action sent back, or null when it sent none or the person has since deleted the content.
items[].response.clientTimestampstring · requiredWhen the person answered, by the phone’s clock. An RFC 3339 timestamp.
items[].response.answeredAtstring · requiredWhen the answer reached Nibify. An RFC 3339 timestamp.
nextCursorstring or null · requiredThe cursor of the next page, or null on the last one.

Create a Request

POST/v1/requests

Creates a pending Request and validates its Surface against the catalog. Send Idempotency-Key only if you retry automatically: the returned requestId is already the identity of the Request. Send callbackUrl to be called once, with a signed POST, when the Request reaches a terminal state — a workflow that pauses can resume on it, instead of holding a long poll open.

Headers

Headers
FieldDescription
Authorizationstring · requiredBearer sk_test_…: an API key of your project.
Idempotency-KeystringSend only if you retry automatically. The same key with the same request returns the Request already created, with 200; with a different request it is a 422.

Request body

Request body
FieldDescription
senderobject · requiredWho the person sees the Request as coming from.
sender.namestring · requiredThe name the person sees, free text. Not empty.
sender.iconstringAn icon for the sender, free text, kept and returned as sent. Nothing draws it: the person sees the sender by its name. Not empty.
notificationobject · requiredWhat the push says, and the buttons it offers.
notification.titlestring · requiredThe title of the push and of its Inbox row. Not empty.
notification.bodystring · requiredThe text of the push and of its Inbox row. Not empty.
notification.quickActionsarray of objectsButtons on the push itself, answerable from the lock screen. Not empty.
notification.quickActions[].namestring · requiredThe action the button dispatches, and the actionName of the Response it produces. With a surface, it must be an action the Surface dispatches. Not empty.
notification.quickActions[].labelstring · requiredThe button’s text on the notification. Not empty.
prioritystringHow loudly the Request announces itself: low only in the Inbox, normal with a push, high with a push that may break through the person’s quiet hours. One of low, normal, high. Defaults to normal.
threadKeystringYour name for a conversation: Requests sent with the same key join one Thread. Without it, the Request is a Thread of its own. 1 to 200 characters.
surfaceobjectThe interactive UI the person answers in, checked against the catalog. Without it, the push and its quickActions are the whole Request.
surface.rootstring · requiredThe id of the component the Surface is drawn from: always root, and one of components must carry it. Not empty.
surface.dataModelobject · requiredThe flat JSON state the components bind to by JSON Pointer, and the source of the values an action sends back.
surface.componentsarray of objects · requiredThe components, as a flat list, each one checked against the catalog. Not empty.
expiresAtstringWhen the Request expires if nobody has answered it, in the future. Without it, the Request waits indefinitely. An RFC 3339 timestamp.
callbackUrlstringA public https URL called once, with a signed POST, when the Request reaches a terminal state. A URL. At most 2048 characters.

Example

import { Nibify } from '@nibify/sdk';

const nibify = new Nibify({ apiKey: 'sk_test_…' });

const result = await nibify.ask({
  sender: { name: 'invoice-flow' },
  notification: {
    title: 'Kiwi Studio invoice: $1,240, due Oct 30',
    body: 'Read from the PDF. File it as consulting, or fix it first.',
    quickActions: [
      { name: 'file', label: 'File it' },
      { name: 'fix', label: 'Fix it' },
    ],
  },
});

if (result.status === 'answered') {
  result.response.actionName; // 'file'
}

Responses

Responses
StatusDescription
200This Idempotency-Key had already created this exact Request. Nothing was created; the original Request is returned as it stands now.
201The Request was created.
401unauthorized for a missing or unusable key, api_key_revoked for a revoked one.
402plan_limit_reached. The Messages the account’s plan allows this month in this key’s Environment are spent — Requests and notifications together, across every Project of the account, counted from the first day of the month in UTC. test and live have a monthly allowance each, counted apart, so a spent test never refuses a live key, nor the other way round. The message names the Environment, the plan, its limit, the day the count starts again and where to upgrade. Nothing was created. Unlike a 429 there is no Retry-After: retrying is refused the same way until the month turns or the plan changes.
422surface_invalid names the component and property at fault, the root the renderer would not find, or the quick action whose name is not an action the surface dispatches; idempotency_conflict means this key was already used for a different request; callback_url_invalid means the callbackUrl is not a public https endpoint this API is willing to call; invalid_request_body is a malformed envelope.
429rate_limited. This project is over its requests-per-second ceiling or its daily volume in the environment this key speaks for; the message says which of the two it was. The budget is the project’s and not the key’s, so another API key of the same project shares it — the test and live halves are counted apart. Nothing was created and nothing was counted: retrying after Retry-After is safe. Header Retry-After: how many seconds to wait before retrying. Always a whole number, never below 1.

Response body, 200 and 201

Response body, 200 and 201
FieldDescription
requestIdstring · requiredThe Request’s id: read it, wait for it, withdraw it or nudge it by this.
threadIdstring · requiredThe Thread the Request joined.
sequenceinteger · requiredThe Request’s position in its Thread, starting at 1.
interactionTypestring · requiredInferred, never sent: conversation when the Request joined a Thread that already had Messages, action otherwise. One of action, conversation.
statusstring · requiredThe status the Request has now. On an idempotent replay, whatever the original has become since. One of pending, answered, expired, dismissed, cancelled.
createdAtstring · requiredWhen the Request was created. An RFC 3339 timestamp.
expiresAtstring or null · requiredWhen the Request expires, or null if it never does. An RFC 3339 timestamp.
environmentstring · requiredThe Environment of the API key that created it. One of test, live.
minCatalogVersioninteger or null · requiredThe lowest catalog version that can draw the Surface, worked out by the server. Null when there is no Surface.
warningsarray of objects · requiredWhat did not stop the Message but changes how it is shown: catalog_version_too_low when no installed app can draw the Surface.
warnings[].codestring · requiredWhat the warning is about, for a program to branch on. Always catalog_version_too_low.
warnings[].messagestring · requiredThe same warning, in a sentence for a person.

Read a Request

GET/v1/requests/{id}

Returns the Request as it stands now, without waiting. The same body as GET /v1/requests/{id}/response: read status to tell a Response from an outcome without one, and status: "pending" — nobody has answered yet — from expired, where the Request timed out. deliveredAt and readAt are the two receipts: a pending Request with both null never reached a phone, which is a different problem from one nobody has answered. Use the long poll instead when you intend to wait for the answer.

Headers

Headers
FieldDescription
Authorizationstring · requiredBearer sk_test_…: an API key of your project.

Path parameters

Path parameters
FieldDescription
idstring · requiredThe requestId returned when the Request was created.

Responses

Responses
StatusDescription
200The Request as it stands. response is present exactly when status is answered.
401unauthorized for a missing or unusable key, api_key_revoked for a revoked one.
404request_not_found. A Request belonging to another Project answers the same way as one that does not exist.
429rate_limited. This project is over its requests-per-second ceiling or its daily volume in the environment this key speaks for; the message says which of the two it was. The budget is the project’s and not the key’s, so another API key of the same project shares it — the test and live halves are counted apart. Nothing was created and nothing was counted: retrying after Retry-After is safe. Header Retry-After: how many seconds to wait before retrying. Always a whole number, never below 1.

Response body, 200

Response body, 200
FieldDescription
requestIdstring · requiredThe Request’s id.
statusstring · requiredWhere the Request is: pending until it reaches one of the four terminal states. One of pending, answered, expired, dismissed, cancelled.
createdAtstring · requiredWhen the Request was created. An RFC 3339 timestamp.
expiresAtstring or null · requiredWhen the Request expires, or null if it never does. An RFC 3339 timestamp.
environmentstring · requiredThe Environment of the API key that created it. One of test, live.
deliveredAtstring or null · requiredWhen a phone of the recipient first confirmed the push arrived. Null means not confirmed yet, not that it was not sent. An RFC 3339 timestamp.
readAtstring or null · requiredWhen the person first opened it, or null. Never set while deliveredAt is not. An RFC 3339 timestamp.
contentDeletedAtstring or null · requiredWhen the person deleted what was said in this Request, or null. From then on response.context is null. An RFC 3339 timestamp.
responseobject or null · requiredThe person’s answer: present exactly when status is answered.
response.responseIdstring · requiredThe Response’s id.
response.actionNamestring · requiredThe action the person chose.
response.sourceComponentIdstring · requiredThe id of the component the person answered with, or notification for a quick action on the push.
response.contextobject or null · requiredThe values the action sent back, or null when it sent none or the person has since deleted the content.
response.clientTimestampstring · requiredWhen the person answered, by the phone’s clock. An RFC 3339 timestamp.
response.answeredAtstring · requiredWhen the answer reached Nibify. An RFC 3339 timestamp.

Withdraw a Request

DELETE/v1/requests/{id}

Moves a pending Request to cancelled: the agent no longer needs the answer. Nothing is deleted — the Request stays readable, and cancelled is what tells the agent later that it withdrew rather than the person letting it lapse. A Request that reached any terminal state first is a 409 naming that state; request_already_answered means the person won the race and there is a Response to read.

Headers

Headers
FieldDescription
Authorizationstring · requiredBearer sk_test_…: an API key of your project.

Path parameters

Path parameters
FieldDescription
idstring · requiredThe requestId returned when the Request was created.

Responses

Responses
StatusDescription
200The Request was withdrawn. response is always null here.
401unauthorized for a missing or unusable key, api_key_revoked for a revoked one.
404request_not_found. A Request belonging to another Project answers the same way as one that does not exist.
409The Request was already terminal — the code names which state won: request_already_answered, request_already_expired, request_already_dismissed or request_already_cancelled.
429rate_limited. This project is over its requests-per-second ceiling or its daily volume in the environment this key speaks for; the message says which of the two it was. The budget is the project’s and not the key’s, so another API key of the same project shares it — the test and live halves are counted apart. Nothing was created and nothing was counted: retrying after Retry-After is safe. Header Retry-After: how many seconds to wait before retrying. Always a whole number, never below 1.

Response body, 200

Response body, 200
FieldDescription
requestIdstring · requiredThe Request’s id.
statusstring · requiredThe terminal state the Request is in. One of answered, expired, dismissed, cancelled.
createdAtstring · requiredWhen the Request was created. An RFC 3339 timestamp.
expiresAtstring or null · requiredWhen the Request expires, or null if it never does. An RFC 3339 timestamp.
environmentstring · requiredThe Environment of the API key that created it. One of test, live.
deliveredAtstring or null · requiredWhen a phone of the recipient first confirmed the push arrived. Null means not confirmed yet, not that it was not sent. An RFC 3339 timestamp.
readAtstring or null · requiredWhen the person first opened it, or null. Never set while deliveredAt is not. An RFC 3339 timestamp.
contentDeletedAtstring or null · requiredWhen the person deleted what was said in this Request, or null. From then on response.context is null. An RFC 3339 timestamp.
responseobject or null · requiredThe person’s answer: present exactly when status is answered.
response.responseIdstring · requiredThe Response’s id.
response.actionNamestring · requiredThe action the person chose.
response.sourceComponentIdstring · requiredThe id of the component the person answered with, or notification for a quick action on the push.
response.contextobject or null · requiredThe values the action sent back, or null when it sent none or the person has since deleted the content.
response.clientTimestampstring · requiredWhen the person answered, by the phone’s clock. An RFC 3339 timestamp.
response.answeredAtstring · requiredWhen the answer reached Nibify. An RFC 3339 timestamp.

Re-notify a pending Request

POST/v1/requests/{id}/nudge

Fires the push for a Request that is still waiting, without creating a second Request and without touching its state — no status, no sequence, no timestamp changes. Distinct from withdrawing and re-sending, which produces a cancelled Request and a new one. It obeys the priority the Request was created with and the recipient's quiet hours exactly as the first push did, so a normal Request nudged at three in the morning does not ring. A Request that already reached a terminal state is a 409 naming that state, never a silent no-op.

Headers

Headers
FieldDescription
Authorizationstring · requiredBearer sk_test_…: an API key of your project.

Path parameters

Path parameters
FieldDescription
idstring · requiredThe requestId returned when the Request was created.

Responses

Responses
StatusDescription
200The push was queued again. The Request is unchanged, and is returned as it stands.
401unauthorized for a missing or unusable key, api_key_revoked for a revoked one.
404request_not_found. A Request belonging to another Project answers the same way as one that does not exist.
409The Request is no longer pending, so there is nothing to re-notify — the code names which state it reached: request_already_answered, request_already_expired, request_already_dismissed or request_already_cancelled.
429rate_limited. This project is over its requests-per-second ceiling or its daily volume in the environment this key speaks for; the message says which of the two it was. The budget is the project’s and not the key’s, so another API key of the same project shares it — the test and live halves are counted apart. Nothing was created and nothing was counted: retrying after Retry-After is safe. Header Retry-After: how many seconds to wait before retrying. Always a whole number, never below 1.

Response body, 200

Response body, 200
FieldDescription
requestIdstring · requiredThe Request’s id.
statusstring · requiredWhere the Request is: pending until it reaches one of the four terminal states. One of pending, answered, expired, dismissed, cancelled.
createdAtstring · requiredWhen the Request was created. An RFC 3339 timestamp.
expiresAtstring or null · requiredWhen the Request expires, or null if it never does. An RFC 3339 timestamp.
environmentstring · requiredThe Environment of the API key that created it. One of test, live.
deliveredAtstring or null · requiredWhen a phone of the recipient first confirmed the push arrived. Null means not confirmed yet, not that it was not sent. An RFC 3339 timestamp.
readAtstring or null · requiredWhen the person first opened it, or null. Never set while deliveredAt is not. An RFC 3339 timestamp.
contentDeletedAtstring or null · requiredWhen the person deleted what was said in this Request, or null. From then on response.context is null. An RFC 3339 timestamp.
responseobject or null · requiredThe person’s answer: present exactly when status is answered.
response.responseIdstring · requiredThe Response’s id.
response.actionNamestring · requiredThe action the person chose.
response.sourceComponentIdstring · requiredThe id of the component the person answered with, or notification for a quick action on the push.
response.contextobject or null · requiredThe values the action sent back, or null when it sent none or the person has since deleted the content.
response.clientTimestampstring · requiredWhen the person answered, by the phone’s clock. An RFC 3339 timestamp.
response.answeredAtstring · requiredWhen the answer reached Nibify. An RFC 3339 timestamp.

Await the outcome of a Request

GET/v1/requests/{id}/response

Resolves as soon as the Request reaches a terminal state, or when wait seconds have passed. Always a 200: read status to tell a Response from an outcome without one, and status: "pending" — the Wait window ran out, the Request is still waiting — from expired, where the Request itself timed out. Re-issue on pending. Waiting is free: this endpoint does not count against the project's rate limit, however long it is held open or however often it is re-issued.

Headers

Headers
FieldDescription
Authorizationstring · requiredBearer sk_test_…: an API key of your project.

Path parameters

Path parameters
FieldDescription
idstring · requiredThe requestId returned when the Request was created.

Query parameters

Query parameters
FieldDescription
waitintegerHow many seconds to hold the connection open for a terminal state. 0 answers at once. Between 0 and 30. Defaults to 0.

Responses

Responses
StatusDescription
200What awaiting the Request resolved to. response is present exactly when status is answered.
401unauthorized for a missing or unusable key, api_key_revoked for a revoked one.
404request_not_found. A Request belonging to another Project answers the same way as one that does not exist.
422invalid_request_body — wait must be a whole number of seconds between 0 and 30.

Response body, 200

Response body, 200
FieldDescription
requestIdstring · requiredThe Request’s id.
statusstring · requiredWhere the Request is: pending until it reaches one of the four terminal states. One of pending, answered, expired, dismissed, cancelled.
createdAtstring · requiredWhen the Request was created. An RFC 3339 timestamp.
expiresAtstring or null · requiredWhen the Request expires, or null if it never does. An RFC 3339 timestamp.
environmentstring · requiredThe Environment of the API key that created it. One of test, live.
deliveredAtstring or null · requiredWhen a phone of the recipient first confirmed the push arrived. Null means not confirmed yet, not that it was not sent. An RFC 3339 timestamp.
readAtstring or null · requiredWhen the person first opened it, or null. Never set while deliveredAt is not. An RFC 3339 timestamp.
contentDeletedAtstring or null · requiredWhen the person deleted what was said in this Request, or null. From then on response.context is null. An RFC 3339 timestamp.
responseobject or null · requiredThe person’s answer: present exactly when status is answered.
response.responseIdstring · requiredThe Response’s id.
response.actionNamestring · requiredThe action the person chose.
response.sourceComponentIdstring · requiredThe id of the component the person answered with, or notification for a quick action on the push.
response.contextobject or null · requiredThe values the action sent back, or null when it sent none or the person has since deleted the content.
response.clientTimestampstring · requiredWhen the person answered, by the phone’s clock. An RFC 3339 timestamp.
response.answeredAtstring · requiredWhen the answer reached Nibify. An RFC 3339 timestamp.