> ## Documentation Index
> Fetch the complete documentation index at: https://docs.d-api.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Get async command

> Track the result of a command sent with async.

When you send a command with `async: true`, the API responds immediately with a
`commandId` and runs the command in the background. This endpoint tells you what
happened to it.

```json theme={null}
{
  "success": true,
  "commandId": "9f1c8f2e-4b7a-4f10-9c3d-2e1a8b5d7c40",
  "sessionId": "minha-sessao",
  "commandType": "send_text",
  "status": "completed",
  "result": {
    "commandId": "9f1c8f2e-4b7a-4f10-9c3d-2e1a8b5d7c40",
    "sessionId": "minha-sessao",
    "commandType": "send_text",
    "success": true,
    "data": { "messageId": "3EB0C767D26B8CA3F7A1" },
    "error": null,
    "timestamp": "2026-09-03T04:15:22.318Z"
  },
  "error": null,
  "queuedAt": "2026-09-03T04:15:21.902Z",
  "startedAt": "2026-09-03T04:15:22.104Z",
  "finishedAt": "2026-09-03T04:15:22.318Z"
}
```

## Status

| `status` | Meaning |
| - | - |
| `queued` | In the queue, not started yet |
| `processing` | Running now |
| `completed` | Finished running — check `result.success` |
| `failed` | The worker failed before finishing; the reason is in `error` |

> [!WARNING]
>
> `status` is not the command's success. A command that ran and failed (invalid
> number, disconnected session) ends up `completed` with `result.success: false` and
> the reason in `result.error`. `status: "failed"` only covers worker failure.

The `result` field carries the same payload as the `command.result` webhook and is only
filled in when the command finishes. Until then it is `null`.

## Scope and retention

You can only see commands from your own sessions. An API Key restricted to a
session can only query that session's commands. A third party's command returns
`404`, just like a nonexistent `commandId`.

> [!NOTE]
>
> The result is available for a limited window — about 1 hour after
> execution (24 hours in case of worker failure). After that, the response
> is `404`. For guaranteed delivery, use the
> [`command.result`](https://docs.d-api.cloud/en/whatsapp/comandos-assincronos) webhook
> instead of polling.


## OpenAPI

````yaml api-reference/openapi.en.json GET /api/v1/commands/{commandId}
openapi: 3.1.0
info:
  title: D-API - Complete WhatsApp Infrastructure
  description: >-
    A scalable, robust solution for automation managers, SaaS products and end
    users who need a reliable WhatsApp integration. It offers multiple
    simultaneous instances, real-time webhooks, an intuitive dashboard and a
    documented REST API with 99.9% uptime and latency under 30ms.
  version: 1.2.1
  contact:
    name: Suporte D-API
    email: suporte@d-api.cloud
    url: https://d-api.cloud
servers:
  - url: https://api.d-api.cloud
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Home
    description: Base endpoints
  - name: Sessions
    description: Endpoints for managing sessions
  - name: Messages
    description: Endpoints for sending messages
  - name: Cloud API
    description: >-
      WhatsApp Official API (Meta Cloud API): manual connection, template
      management (list/create/delete) and template sending.
  - name: IVR Calls
    description: 'Voice call dispatch (IVR): single or bulk, with audio or an IVR flow.'
  - name: SMS
    description: 'SMS sending: single or bulk.'
  - name: Commands
    description: >-
      Look up asynchronous commands (async: true) by the commandId returned when
      enqueued.
paths:
  /api/v1/commands/{commandId}:
    get:
      tags:
        - Commands
      summary: Get asynchronous command
      description: >-
        Gets the state and result of a command sent with `async: true`, by the
        `commandId` returned when enqueued.


        `status`: `queued` (in the queue), `processing` (running), `completed`
        (executed — check `result.success` to know whether the command
        succeeded) or `failed` (the worker failed; see `error`).


        The result is available for a limited queue retention window; for
        guaranteed delivery use the `command.result` webhook.
      operationId: getApiV1CommandsByCommandId
      parameters:
        - schema:
            minLength: 1
            type: string
          in: path
          name: commandId
          required: true
      responses:
        '200':
          description: Successful response
        '404':
          description: >-
            Command does not exist, expired from the queue or is outside the
            credential's scope
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'API Key for authentication. Format: <API_KEY>'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.