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

# Reordenar Tiendas

> Aprenda a reordenar las tiendas de la cuenta usando el endpoint PUT /stores/reorder.

## 📌 Endpoint

`PUT /stores/reorder`

Reordena las tiendas de la cuenta autenticada según la secuencia enviada en `storeIds`.

***

## 🔐 Autenticación

* Ruta privada.
* Envíe `Authorization` con su API Key.

***

## 🧍 Body

| Campo | Tipo | Obligatorio | Reglas |
| - | - | - | - |
| `storeIds` | string\[] | Sí | array con IDs únicos de las tiendas de la cuenta, en el orden final |

***

## ✅ Ejemplo de solicitud

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

***

## 📦 Respuesta de éxito (200)

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

***

## ⚠️ Posibles errores

* `400 INVALID_DATA` → payload inválido
* `400 STORE_LIST_INVALID` → uno o más IDs no pertenecen a la cuenta
* `401 API_KEY_NOT_PROVIDED` → header `Authorization` no enviado
* `401 INVALID_API_KEY` → API Key inválida o no encontrada
* `401 UNAUTHENTICATED` → sesión/usuario no autenticado
* `403 USER_DISABLED` → cuenta de usuario desactivada o eliminada
* `403 NO_ACTIVE_SUBSCRIPTION` → cuenta sin plan activo
* `429 RATE_LIMIT_EXCEEDED` → límite de solicitudes por minuto del plan excedido
* `500 INTERNAL_SERVER_ERROR` → error interno
* `503 SERVICE_UNAVAILABLE` → servicio temporalmente no disponible

***

## 📝 Observaciones

* El endpoint `GET /stores` retorna las tiendas ordenadas por `position`.
* El frontend debe enviar la lista completa de IDs en el orden final para garantizar consistencia.


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