> ## 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 Products

> Execute a command on one or more Product records.

Executes a command on one or more Product records. Use the [Commands endpoint](https://learn.nexudus.com/rest-api/billing/get-products-commands.md) 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 **`Product-Update`** role.

## Request Body

**Key** `string` *required*

The command key to execute. Obtain available keys from the [Commands endpoint](https://learn.nexudus.com/rest-api/billing/get-products-commands.md).

**Ids** `integer[]` *required*

List of Product record Ids to execute the command on.

**Parameters** `object[]`

If the command requires parameters, provide them as an array of objects with `Name` and `Value` fields.

## Code Examples

```bash cURL theme={null}
curl -X POST \
  "https://spaces.nexudus.com/api/billing/products/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/billing/products/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/billing/products/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()
```

## Response

### 200

**Status** `integer`

HTTP status code. `200` on success.

**Message** `string`

A human-readable message confirming the command was executed.

**Value** `object`

Contains details about the command execution result.

**WasSuccessful** `boolean`

`true` if the command was executed successfully.

**Errors** `array`

`null` on success.

```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
}
```


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