
## Order status fields

`GET /v1/order-statuses/fields`

Returns a static map of status fields: the type of each field, the read-only flag, the list of aggregatable fields, and the available batch operations. There is no dynamically loaded description or display name of fields here — this is a fixed type schema.

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/order-statuses/fields" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/order-statuses/fields" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/order-statuses/fields', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { data } = await res.json()
console.log('Status fields:', Object.keys(data.fields))
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/order-statuses/fields', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `id` | string | Status character code. Set by the user on creation |
| `type` | string | Status type: `O` — order, `D` — delivery |
| `sort` | number \| null | Sort order. Can be `null` in query results |
| `notify` | boolean | Whether to send a notification to the customer |
| `color` | string \| null | HEX color code. Can be `null` in query results |
| `xmlId` | string \| null | External identifier. Can be `null` in query results |

## Response example

```json
{
  "success": true,
  "data": {
    "fields": {
      "id": { "type": "string", "readonly": false },
      "type": { "type": "string", "readonly": false },
      "sort": { "type": "number", "readonly": false },
      "notify": { "type": "boolean", "readonly": false },
      "color": { "type": "string", "readonly": false },
      "xmlId": { "type": "string", "readonly": false }
    },
    "aggregatable": ["type", "notify"],
    "batch": ["create", "update", "delete"]
  }
}
```

## Error response example

403 — no scope:

```json
{
  "success": false,
  "error": {
    "code": "SCOPE_DENIED",
    "message": "This endpoint requires 'sale' scope"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 403 | `SCOPE_DENIED` | The API key does not have the `sale` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

Full list of general API errors — [Errors](/docs/errors).

## See also

- [List statuses](./list.md)
- [Create status](./create.md)
- [Aggregate statuses](./aggregate.md)
- [Order statuses](../order-statuses.md)
- [Entity API](/docs/entity-api)
