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

# Obtener Categoría por ID

> Aprende a consultar una categoría específica de la tienda usando el endpoint GET /stores/{storeId}/categories/{categoryId}.

## 📌 Endpoint

`GET /stores/{storeId}/categories/{categoryId}`

Devuelve una categoría específica de la tienda, incluyendo productos y cupones relacionados.

***

## 🔐 Autenticación

* **Ruta pública** para consulta.
* La tienda vinculada a `storeId` debe tener plan activo.

***

## 🧾 Parámetros de ruta

| Parámetro | Tipo | Obligatorio | Descripción |
| - | - | - | - |
| `storeId` | string | Sí | ID de la tienda |
| `categoryId` | string | Sí | ID de la categoría |

***

## ✅ Ejemplo de solicitud

```bash theme={null}
curl -X GET "https://api.cabrapi.com.br/v1/stores/STORE_ID/categories/CATEGORY_ID"
```

***

## 📦 Respuesta exitosa (200)

```json theme={null}
{
	"code": "CATEGORY_FETCHED",
	"category": {
		"id": "CATEGORY_ID",
		"name": "Eletrônicos",
		"description": "Produtos eletrônicos em geral",
		"image": null,
		"metadata": {
			"featured": true,
			"slug": "eletronicos"
		},
		"position": 1,
		"storeId": "STORE_ID",
		"products": [],
		"coupons": [],
		"createdAt": "2026-03-02T20:00:00.000Z",
		"updatedAt": "2026-03-02T20:00:00.000Z"
	}
}
```

***

## ⚠️ Posibles errores

* `400 INVALID_DATA` → parámetros inválidos
* `401 UNAUTHENTICATED` → no fue posible identificar al usuario de la suscripción
* `403 NO_ACTIVE_SUBSCRIPTION` → plan inactivo o expirado
* `404 STORE_NOT_FOUND` → tienda no encontrada
* `404 CATEGORY_NOT_FOUND` → categoría no encontrada
* `429 RATE_LIMIT_EXCEEDED` → límite de solicitudes por minuto excedido
* `500 INTERNAL_SERVER_ERROR` → error interno
* `503 SERVICE_UNAVAILABLE` → servicio o base de datos no disponible


## OpenAPI

````yaml GET /stores/{storeId}/categories/{categoryId}
openapi: 3.1.0
info:
  title: caBRAPI
  version: 1.0.0
servers:
  - url: https://api.cabrapi.com.br/v1
security: []
paths:
  /stores/{storeId}/categories/{categoryId}:
    get:
      tags:
        - Categories
      summary: Get category by ID
      operationId: getCategory
      parameters:
        - $ref: '#/components/parameters/StoreId'
        - $ref: '#/components/parameters/CategoryId'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: CATEGORY_FETCHED
                    type: string
                  category:
                    allOf:
                      - $ref: '#/components/schemas/Category'
                      - type: object
                        properties:
                          coupons:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  format: uuid
                                  type: string
                                code:
                                  type: string
                                discount:
                                  type: integer
                                useLimit:
                                  type: integer
                                expiredAt:
                                  format: date-time
                                  nullable: true
                                  type: string
                                createdAt:
                                  format: date-time
                                  type: string
                                updatedAt:
                                  format: date-time
                                  type: string
                              required:
                                - id
                                - code
                                - discount
                                - useLimit
                                - expiredAt
                                - createdAt
                                - updatedAt
                          products:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  format: uuid
                                  type: string
                                name:
                                  type: string
                                description:
                                  nullable: true
                                  type: string
                                image:
                                  nullable: true
                                  type: string
                                price:
                                  type: number
                                stock:
                                  type: integer
                                sold:
                                  type: integer
                                delivery:
                                  enum:
                                    - DIGITAL
                                    - PHYSICAL
                                  type: string
                                metadata:
                                  nullable: true
                                  type: object
                                createdAt:
                                  format: date-time
                                  type: string
                                updatedAt:
                                  format: date-time
                                  type: string
                              required:
                                - id
                                - name
                                - price
                                - stock
                                - sold
                                - delivery
                                - createdAt
                                - updatedAt
                        required:
                          - coupons
                          - products
                required:
                  - code
                  - category
                type: object
          description: Get category by ID.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Invalid request.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Unauthorized (missing store owner or unavailable database).
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden (inactive plan or insufficient permissions).
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Resource not found.
        '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: []
components:
  parameters:
    StoreId:
      in: path
      name: storeId
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 50
    CategoryId:
      in: path
      name: categoryId
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 50
  schemas:
    Category:
      description: Store product category.
      properties:
        createdAt:
          format: date-time
          type: string
        description:
          nullable: true
          type: string
        id:
          format: uuid
          type: string
        image:
          nullable: true
          type: string
        metadata:
          nullable: true
          type: object
        name:
          type: string
        position:
          type: integer
        storeId:
          format: uuid
          type: string
        updatedAt:
          format: date-time
          type: string
      required:
        - id
        - name
        - position
        - storeId
        - createdAt
        - updatedAt
      type: object
    Error:
      properties:
        code:
          example: STORE_NOT_FOUND
          type: string
      required:
        - code
      type: object

````

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