## Change a number range (tenant:settings:write)

`PUT /api/masterdata/sequences/{type}`

Module: Master data · operationId: `updateSequence` · Tag: Settings · Auth: access token (`Authorization: Bearer <accessToken>`)

Sets prefix, counter (the last assigned value) and the minimum number of digits. Numbers that are already taken are skipped when assigning. A counter below the highest number already issued with that prefix (`highestIssued`) answers `400` on `currentValue`.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `type` | path | string | yes | Number range (case-insensitive): ADDRESS, PRODUCT, MANDATE or a named address range ADDRESS:NAME |

### Request body

`application/json` (required)

- `minDigits` (integer, required): Minimum number of digits (zero-padded) (max 18)
- `currentValue` (integer (int64)): Last assigned value; not below `highestIssued`
- `label` (string): Optional; omitted keeps the label (max length 128)
- `prefix` (string): No whitespace (max length 16)

Example:

```json
{
  "currentValue": 41,
  "minDigits": 5,
  "prefix": "A"
}
```

### Responses

- **200** Saved (`application/json`)
- **400** Malformed body or query parameter (`application/json`)
- **401** Missing, invalid or expired token (empty body)
- **403** The token lacks the permission or carries no tenant (`application/json`)
- **404** Not found in the caller's tenant (or merged, see `code`) (`application/json`)

Fields of the 200 answer:

- `currentValue` (integer (int64), required): Last assigned value
- `highestIssued` (integer (int64), required): Highest number with this prefix already in use (0 when none); the counter cannot be set below it
- `minDigits` (integer, required): Minimum number of digits (zero-padded)
- `nextNumber` (string, required): The next number that would be assigned
- `prefix` (string, required): Prefix of the numbers
- `sequenceType` (string, required): ADDRESS, PRODUCT, MANDATE or a named address range ADDRESS:NAME
- `updatedAt` (string (date-time), required): Time of the last change
- `label` (string): Name of a named range

Example 200 answer:

```json
{
  "currentValue": 70011,
  "highestIssued": 70011,
  "label": "Lieferantennummern",
  "minDigits": 5,
  "nextNumber": "70012",
  "prefix": "",
  "sequenceType": "ADDRESS:LIEFERANT",
  "updatedAt": "2026-09-02T14:30:00Z"
}
```

### Example request

```bash
curl -X PUT 'https://api.mbcom.cloud/api/masterdata/sequences/ADDRESS:KUNDEN' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"currentValue":41,"minDigits":5,"prefix":"A"}'
```
