### Set the bucket drain order

`PUT /api/v1/users/{id}/bucket-order`

Replaces the subscriber's custom drain order. Every id must be one of their active buckets, except the sentinel 0, which stands for the plan's own main quota and may be placed anywhere in the sequence.

- Authentication: manager session (JWT) or API token
- Permission: `prm_users_buckets` (Manage quota buckets)
- Risk: write
- Rate limit bucket: `t_mutate`

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Subscriber id. |
| `order` | body | array | yes | Bucket ids in drain order. 0 is the main quota, not a missing value. |

#### Request

```json
{
  "order": [331, 0, 402]
}
```

#### Errors

| Code | Status | When |
| --- | --- | --- |
| `ERR_VALIDATION` | 400 | an id is not one of this subscriber's active buckets, or the array is too long |

#### Note

The 0 in that array is meaningful and positional. It is the main plan quota, so stripping non-positive ids as "empty" would silently reorder the drain sequence rather than reject it.

