> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nexudus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run command for CoworkerInventoryAssets

> Execute a command on one or more CoworkerInventoryAsset records.

Executes a command on one or more CoworkerInventoryAsset records. Use the [Commands endpoint](/rest-api/spaces/get-coworkerinventoryassets-commands) to discover available commands and their required parameters.

## Authentication

<Note>
  This endpoint requires OAuth2 authentication. Include a valid bearer token in the `Authorization` header.
  The authenticated user must be a full unrestricted administrator or have the **`CoworkerInventoryAsset-Update`** role.
</Note>

## Request Body

<ParamField body="Key" type="string" required>
  The command key to execute. Obtain available keys from the [Commands endpoint](/rest-api/spaces/get-coworkerinventoryassets-commands).
</ParamField>

<ParamField body="Ids" type="integer[]" required>
  List of CoworkerInventoryAsset record Ids to execute the command on.
</ParamField>

<ParamField body="Parameters" type="object[]">
  If the command requires parameters, provide them as an array of objects with `Name` and `Value` fields.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    "https://spaces.nexudus.com/api/spaces/coworkerinventoryassets/runcommand" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "Key": "COMMAND_KEY_1",
      "Ids": [87654321, 87654322],
      "Parameters": [
        {
          "Name": "Parameter name",
          "Value": "Parameter value"
        }
      ]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/spaces/coworkerinventoryassets/runcommand',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        Key: 'COMMAND_KEY_1',
        Ids: [87654321, 87654322],
        Parameters: [
          {
            Name: 'Parameter name',
            Value: 'Parameter value'
          }
        ]
      })
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://spaces.nexudus.com/api/spaces/coworkerinventoryassets/runcommand',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'Key': 'COMMAND_KEY_1',
          'Ids': [87654321, 87654322],
          'Parameters': [
              {
                  'Name': 'Parameter name',
                  'Value': 'Parameter value'
              }
          ]
      }
  )

  data = response.json()
  ```
</CodeGroup>

## Response

### 200

<ResponseField name="Status" type="integer">
  HTTP status code. `200` on success.
</ResponseField>

<ResponseField name="Message" type="string">
  A human-readable message confirming the command was executed.
</ResponseField>

<ResponseField name="Value" type="object">
  Contains details about the command execution result.
</ResponseField>

<ResponseField name="WasSuccessful" type="boolean">
  `true` if the command was executed successfully.
</ResponseField>

<ResponseField name="Errors" type="array">
  `null` on success.
</ResponseField>

```json Example Response theme={null}
{
  "Status": 200,
  "Message": "The command was run correctly.",
  "Value": null,
  "OpenInDialog": false,
  "OpenInWindow": false,
  "RedirectURL": null,
  "JavaScript": null,
  "UpdatedOn": "2025-01-15T12:00:00Z",
  "UpdatedBy": "admin@example.com",
  "Errors": null,
  "WasSuccessful": true
}
```
