---
title: "Create command"
method: POST
path: "/v1/commands"
tags: ["Commands"]
---

# Create command

`POST /v1/commands`

Use this endpoint to create a new command for an on-premises connector/agent. It also automatically sends command to SQS queue for execution. Once it is in the queue, the connector/agent listening on the target queue picks up the command,  tries to execute it, and sends the response back to the command service.
The maximum create command request size is 10 MB.

## Request body

- object
  - `targetId` string, required — Agent or Connector ID for which command should be created
  - `action` string, required — Action label, such as `TetraScience.Connector.sdc.CreateMeasurementOrder`
  - `expiresAt` string, required — Command expiration time (ISO timestamp). Must be at least 60 seconds from the current time.
  - `metadata` object — Metadata key-value pairs
  - `payload` object, required — Request body for the command
  - `payloadDelivery` 'embedded' | 'referenced' — The delivery method for the command payload. When "embedded" is specified the command body is included in the SQS message payload. When "referenced" is specified the command body is stored in S3 and only a reference to the S3 object is included in the SQS message payload. In case no value is passed and payload is small enough to be transferred over SQS "embedded" is used, otherwise "referenced" is used.

## Response `200`

200

- object
  - `id` string
  - `orgSlug` string
  - `targetId` string
  - `action` string
  - `expiresAt` string
  - `metadata` object
  - `status` string
  - `requestBody` object
    - `body` object
      - `url` string
      - `body` object
        - `raw` string
        - `mode` string
      - `method` string
      - `headers` object[]
        - `Authorization` string
      - `ignore_tls_certificate` boolean
    - `action` string
    - `targetId` string
    - `commandId` string
    - `createdAt` string
    - `expiresAt` string
  - `responseBody` unknown
  - `requestPayloadDelivery` 'embedded' | 'referenced'
  - `createdByEntity` string
  - `createdBy` string
  - `createdAt` string
  - `updatedAt` string

## Other responses

- `400` — 400
- `500` — 500

---

[API](https://skmtc.net/tetrascience/apis/tetra-data-lake.md) · [All operations](https://skmtc.net/tetrascience/apis/tetra-data-lake/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tetrascience/tetra-data-lake/revisions/0205e2bace53/schema)
