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

# Reorder Stores

> Learn how to reorder the account stores using the PUT /stores/reorder endpoint.

## 📌 Endpoint

`PUT /stores/reorder`

Reorders the stores of the authenticated account according to the sequence sent in `storeIds`.

***

## 🔐 Authentication

* Private route.
* Send `Authorization` with your API Key.

***

## 🧍 Body

| Field | Type | Required | Rules |
| - | - | - | - |
| `storeIds` | string\[] | Yes | array with the unique IDs of the account stores, in the final order |

***

## ✅ Request example

```bash theme={null}
curl -X PUT "https://api.cabrapi.com.br/v1/stores/reorder" \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "storeIds": [
      "STORE_ID_3",
      "STORE_ID_1",
      "STORE_ID_2"
    ]
  }'
```

***

## 📦 Success response (200)

```json theme={null}
{
  "code": "STORES_REORDERED"
}
```

***

## ⚠️ Possible errors

* `400 INVALID_DATA` → invalid payload
* `400 STORE_LIST_INVALID` → one or more IDs do not belong to the account
* `401 API_KEY_NOT_PROVIDED` → `Authorization` header not sent
* `401 INVALID_API_KEY` → invalid or not found API Key
* `401 UNAUTHENTICATED` → session/user not authenticated
* `403 USER_DISABLED` → user account disabled or deleted
* `403 NO_ACTIVE_SUBSCRIPTION` → account has no active plan
* `429 RATE_LIMIT_EXCEEDED` → plan per-minute request limit exceeded
* `500 INTERNAL_SERVER_ERROR` → internal error
* `503 SERVICE_UNAVAILABLE` → service temporarily unavailable

***

## 📝 Notes

* The `GET /stores` endpoint returns stores ordered by `position`.
* The frontend must send the full list of IDs in the final order to ensure consistency.


## OpenAPI

````yaml PUT /stores/reorder
openapi: 3.1.0
info:
  title: caBRAPI
  version: 1.0.0
servers:
  - url: https://api.cabrapi.com.br/v1
security: []
paths:
  /stores/reorder:
    put:
      tags:
        - Stores
      summary: Reorder stores
      operationId: reorderStores
      requestBody:
        content:
          application/json:
            schema:
              properties:
                storeIds:
                  items:
                    format: uuid
                    type: string
                  minItems: 1
                  type: array
                  uniqueItems: true
              required:
                - storeIds
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: STORES_REORDERED
                    type: string
                required:
                  - code
                type: object
          description: Positions updated in provided order.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: INVALID_DATA, STORE_LIST_INVALID
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: API_KEY_NOT_PROVIDED, INVALID_API_KEY, UNAUTHENTICATED
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: USER_DISABLED, NO_ACTIVE_SUBSCRIPTION
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Rate limit exceeded.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Service unavailable.
      security:
        - ApiKey: []
components:
  schemas:
    Error:
      properties:
        code:
          example: STORE_NOT_FOUND
          type: string
      required:
        - code
      type: object
  securitySchemes:
    ApiKey:
      in: header
      name: Authorization
      type: apiKey
      x-default: YOUR_API_KEY_HERE

````

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