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

# Obter Produto por ID

> Aprenda a buscar um produto específico usando o endpoint GET /stores/{storeId}/products/{productId}.

## 📌 Endpoint

`GET /stores/{storeId}/products/{productId}`

Retorna um produto específico da loja.

***

## 🔐 Autenticação & Validações

* **Rota pública** para consulta (não utiliza autenticação).
* ⚠️ **Validação de negócio**: O dono da loja deve ter um plano ativo.
  * Se o plano está inativo/expirado, retorna `403 NO_ACTIVE_SUBSCRIPTION`.

***

## 🧾 Parâmetros de rota

| Parâmetro | Tipo | Obrigatório | Descrição |
| - | - | - | - |
| `storeId` | string | Sim | ID da loja |
| `productId` | string | Sim | ID do produto |

***

## ✅ Exemplo de requisição

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

***

## Snippet padrao (cURL)

Use o exemplo cURL da secao Exemplo de requisicao acima como snippet oficial.

***

## 📦 Resposta de sucesso (200)

```json theme={null}
{
	"code": "PRODUCT_FETCHED",
	"product": {
		"id": "PRODUCT_ID",
		"name": "Curso Premium",
		"disabled": false,
		"position": 1,
		"description": "Acesso completo ao conteúdo.",
		"price": 49.9,
		"image": null,
		"delivery": "DIGITAL",
		"stock": 100,
		"sold": 12,
		"storeId": "STORE_ID",
		"metadata": {},
		"createdAt": "2026-03-02T20:00:00.000Z",
		"updatedAt": "2026-03-02T20:00:00.000Z",
		"categories": [
			{
				"id": "CATEGORY_ID",
				"name": "Cursos"
			}
		]
	}
}
```

***

## ⚠️ Possíveis erros

* `400 INVALID_DATA` → parâmetros inválidos (`storeId` ou `productId` vazio ou > 50 caracteres)
* `401 UNAUTHENTICATED` → não foi possível identificar o usuário da assinatura
* `403 NO_ACTIVE_SUBSCRIPTION` → plano inativo ou expirado
* `404 STORE_NOT_FOUND` → loja não encontrada
* `404 PRODUCT_NOT_FOUND` → produto não encontrado (inclusive quando `productId` possui até 50 caracteres, mas não é um UUID válido)
* `429 RATE_LIMIT_EXCEEDED` → limite de requisições por minuto excedido
* `500 INTERNAL_SERVER_ERROR` → erro interno
* `503 SERVICE_UNAVAILABLE` → serviço ou banco de dados indisponível


## OpenAPI

````yaml GET /stores/{storeId}/products/{productId}
openapi: 3.1.0
info:
  title: caBRAPI
  version: 1.0.0
servers:
  - url: https://api.cabrapi.com.br/v1
security: []
paths:
  /stores/{storeId}/products/{productId}:
    get:
      tags:
        - Products
      summary: Get product by ID
      operationId: getProduct
      parameters:
        - $ref: '#/components/parameters/StoreId'
        - $ref: '#/components/parameters/ProductId'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: PRODUCT_FETCHED
                    type: string
                  product:
                    $ref: '#/components/schemas/Product'
                required:
                  - code
                  - product
                type: object
          description: Get product 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
    ProductId:
      in: path
      name: productId
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 50
  schemas:
    Product:
      description: Store product.
      properties:
        categories:
          items:
            properties:
              id:
                format: uuid
                type: string
              name:
                type: string
            required:
              - id
              - name
            type: object
          type: array
        createdAt:
          format: date-time
          type: string
        delivery:
          enum:
            - DIGITAL
            - PHYSICAL
          type: string
        description:
          nullable: true
          type: string
        disabled:
          type: boolean
        id:
          format: uuid
          type: string
        image:
          nullable: true
          type: string
        metadata:
          nullable: true
          type: object
        name:
          type: string
        position:
          type: integer
        price:
          type: number
        sold:
          type: integer
        stock:
          type: integer
        storeId:
          format: uuid
          type: string
        updatedAt:
          format: date-time
          type: string
      required:
        - id
        - name
        - position
        - price
        - delivery
        - stock
        - sold
        - storeId
        - disabled
        - createdAt
        - updatedAt
        - categories
      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.