Ir al contenido

Referencia: Instancias ​

Generada desde el contrato OpenAPI

Esta referencia se genera directamente del contrato de la API, por lo que sus descripciones están en inglés. Puedes descargarlo en openapi.json. Las guías explican cómo usar estos endpoints.

List instances​

GET
/instances

All instances of the workspace, oldest first. Not paginated.

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Respuestas​

The instances.

application/json
JSON
{
  
"data": [
  
  
{
  
  
  
"id": "string",
  
  
  
"name": "string",
  
  
  
"status": "string",
  
  
  
"phone_number": "string",
  
  
  
"profile_name": "string",
  
  
  
"profile_picture_url": "string",
  
  
  
"paired": true,
  
  
  
"capabilities": [
  
  
  
  
"string"
  
  
  
],
  
  
  
"last_error": "string",
  
  
  
"status_changed_at": "string",
  
  
  
"connected_at": "string",
  
  
  
"disconnected_at": "string",
  
  
  
"last_seen_at": "string",
  
  
  
"created_at": "string",
  
  
  
"updated_at": "string"
  
  
}
  
]
}

Ejemplos​


Create an instance​

POST
/instances

Creates an instance in status created. Connect it afterwards to pair a number. The number of instances is limited by the plan.

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Cuerpo de la petición​

application/json
JSON
{
  
"name": "string"
}

Respuestas​

The new instance.

application/json
JSON
{
  
"data": {
  
  
"id": "string",
  
  
"name": "string",
  
  
"status": "string",
  
  
"phone_number": "string",
  
  
"profile_name": "string",
  
  
"profile_picture_url": "string",
  
  
"paired": true,
  
  
"capabilities": [
  
  
  
"string"
  
  
],
  
  
"last_error": "string",
  
  
"status_changed_at": "string",
  
  
"connected_at": "string",
  
  
"disconnected_at": "string",
  
  
"last_seen_at": "string",
  
  
"created_at": "string",
  
  
"updated_at": "string"
  
}
}

Ejemplos​


Get an instance​

GET
/instances/{instance}

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Respuestas​

The instance.

application/json
JSON
{
  
"data": {
  
  
"id": "string",
  
  
"name": "string",
  
  
"status": "string",
  
  
"phone_number": "string",
  
  
"profile_name": "string",
  
  
"profile_picture_url": "string",
  
  
"paired": true,
  
  
"capabilities": [
  
  
  
"string"
  
  
],
  
  
"last_error": "string",
  
  
"status_changed_at": "string",
  
  
"connected_at": "string",
  
  
"disconnected_at": "string",
  
  
"last_seen_at": "string",
  
  
"created_at": "string",
  
  
"updated_at": "string"
  
}
}

Ejemplos​


Delete an instance​

DELETE
/instances/{instance}

Closes the connection if it is live and removes the instance.

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Respuestas​

Deleted.

Ejemplos​


Rename an instance​

PATCH
/instances/{instance}

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Cuerpo de la petición​

application/json
JSON
{
  
"name": "string"
}

Respuestas​

The updated instance.

application/json
JSON
{
  
"data": {
  
  
"id": "string",
  
  
"name": "string",
  
  
"status": "string",
  
  
"phone_number": "string",
  
  
"profile_name": "string",
  
  
"profile_picture_url": "string",
  
  
"paired": true,
  
  
"capabilities": [
  
  
  
"string"
  
  
],
  
  
"last_error": "string",
  
  
"status_changed_at": "string",
  
  
"connected_at": "string",
  
  
"disconnected_at": "string",
  
  
"last_seen_at": "string",
  
  
"created_at": "string",
  
  
"updated_at": "string"
  
}
}

Ejemplos​


Connect an instance​

POST
/instances/{instance}/connect

Starts the connection. It is asynchronous and idempotent (an instance that is already connecting or connected is returned unchanged). A first-time instance moves to qr_required; fetch the QR code and scan it with the phone. A linked instance reconnects without a QR.

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Respuestas​

The connection was requested; poll the instance or wait for the instance.connected webhook.

application/json
JSON
{
  
"data": {
  
  
"id": "string",
  
  
"name": "string",
  
  
"status": "string",
  
  
"phone_number": "string",
  
  
"profile_name": "string",
  
  
"profile_picture_url": "string",
  
  
"paired": true,
  
  
"capabilities": [
  
  
  
"string"
  
  
],
  
  
"last_error": "string",
  
  
"status_changed_at": "string",
  
  
"connected_at": "string",
  
  
"disconnected_at": "string",
  
  
"last_seen_at": "string",
  
  
"created_at": "string",
  
  
"updated_at": "string"
  
}
}

Ejemplos​


Disconnect an instance​

POST
/instances/{instance}/disconnect

Closes the connection but keeps the linked session, so connect restores it without a QR. An instance that is not live is returned unchanged.

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Respuestas​

The instance after disconnecting.

application/json
JSON
{
  
"data": {
  
  
"id": "string",
  
  
"name": "string",
  
  
"status": "string",
  
  
"phone_number": "string",
  
  
"profile_name": "string",
  
  
"profile_picture_url": "string",
  
  
"paired": true,
  
  
"capabilities": [
  
  
  
"string"
  
  
],
  
  
"last_error": "string",
  
  
"status_changed_at": "string",
  
  
"connected_at": "string",
  
  
"disconnected_at": "string",
  
  
"last_seen_at": "string",
  
  
"created_at": "string",
  
  
"updated_at": "string"
  
}
}

Ejemplos​


Log the instance out of WhatsApp​

POST
/instances/{instance}/logout

Unlinks the number from this instance and discards its session. The next connect needs a new QR scan.

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Respuestas​

The instance after logging out.

application/json
JSON
{
  
"data": {
  
  
"id": "string",
  
  
"name": "string",
  
  
"status": "string",
  
  
"phone_number": "string",
  
  
"profile_name": "string",
  
  
"profile_picture_url": "string",
  
  
"paired": true,
  
  
"capabilities": [
  
  
  
"string"
  
  
],
  
  
"last_error": "string",
  
  
"status_changed_at": "string",
  
  
"connected_at": "string",
  
  
"disconnected_at": "string",
  
  
"last_seen_at": "string",
  
  
"created_at": "string",
  
  
"updated_at": "string"
  
}
}

Ejemplos​


Get the pairing QR code​

GET
/instances/{instance}/qr

Available only while the instance is in status qr_required. The QR rotates; the response is never cached. Needs the instances:write scope because it pairs a number.

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Respuestas​

The current QR code as SVG.

application/json
JSON
{
  
"data": {
  
  
"instance_id": "string",
  
  
"format": "string",
  
  
"svg": "string",
  
  
"expires_at": "string"
  
}
}

Ejemplos​