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

# Obter kits disponíveis

> Cotação de kits

## Autenticação

**OAuth 2.0 (Client Credentials):**

Obtenha um token via `POST /oauth/token` com suas credenciais de cliente e use-o como Bearer Token.

```bash theme={null}
curl -X POST https://backend-pied-prod.piedadmin.com.br/api/oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "SEU_CLIENT_ID",
    "client_secret": "SEU_CLIENT_SECRET"
  }'
```

## Sobre este endpoint

Retorna a lista de kits fotovoltaicos disponíveis com base nos parâmetros informados.

Use o endpoint [Obter filtros disponíveis](/api-reference/v2/kits/get-kits-filter) para descobrir quais valores são aceitos em cada campo antes de montar a requisição.


## OpenAPI

````yaml /openapi/kits.json POST /v2/kits
openapi: 3.0.0
info:
  title: Geração de kits
  description: Descrição da documentação.
  termsOfService: https://pied.com.br/sobre
  contact:
    email: suporte@pieta.tech
  version: 1.0.0
servers:
  - url: https://backend-pied-prod.piedadmin.com.br/api
security: []
tags:
  - name: kits
    description: Geração de kits
paths:
  /v2/kits:
    post:
      tags:
        - kits
      summary: Obtem kits disponíveis de acordo com filtros
      description: Cotação de kits
      operationId: generateKits
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KitRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  metadata:
                    type: object
                    properties:
                      total:
                        type: integer
                        description: Total de kits encontrados
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Kit'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityError'
      security:
        - apiKey:
            - v2:kit:*
        - oauth:
            - v2:kit:*
            - v2:kit:read
components:
  schemas:
    KitRequest:
      type: object
      required:
        - structureName
        - structureType
        - inverterVoltage
        - inverterConnectionType
        - power
        - ibgeCode
      properties:
        power:
          type: number
          description: >-
            Potência em kWp. A API retornará a lista com os kits disponíveis
            mais próximos desta potência.
        ibgeCode:
          type: string
          description: >-
            Código IBGE da Cidade de Entrega. Utilizado para calcular
            disponibilidade e frete.
        structureType:
          type: string
          description: >-
            Tipo de estrutura de fixação. Use as opções disponíveis no retorno
            de "structures" do endpoint "Obter filtros disponíveis" (onde label
            é o structureType). Caso não deseje estrutura, envie "nenhuma".
        structureName:
          type: string
          description: >-
            Nome específico da estrutura de fixação. A API retornará a lista de
            kits disponíveis para essa estrutura. Opções disponíveis no retorno
            de "structures" do endpoint "Obter filtros disponíveis". Onde value
            é structureName.
        inverterConnectionType:
          type: string
          description: >-
            Tipo de conexão. A API retornará a lista de kits disponíveis com
            inversores neste tipo de conexão. Opções disponíveis no retorno de
            "voltages" do endpoint "Obter filtros disponíveis". Onde
            tipo_ligacao é o inverterConnectionType.
        inverterVoltage:
          type: integer
          description: >-
            Tensão de saída. A API retornará a lista de kits disponíveis com
            inversores nesta tensão de saída. Opções disponíveis no retorno de
            "voltages" do endpoint "Obter filtros disponíveis". Onde
            tensao_nominal_de_saida_V é o inverterVoltage.
        inverterBrand:
          type: string
          description: >-
            Marca do Inversor. A API retornará a lista de kits disponíveis
            aplicando um filtro por essa marca de inversor. Opções disponíveis
            no retorno de "inverterBrands" do endpoint "Obter filtros
            disponíveis". Onde value é o inverterBrand.
        inverterType:
          type: string
          description: >-
            Tipo de Inversor. A API retornará a lista de kits disponíveis
            aplicando um filtro por esse tipo de inversor. Opções disponíveis no
            retorno de "inverterType" do endpoint "Obter filtros disponíveis".
            Onde value é o inverterType.
          enum:
            - string
            - hibrido
            - micro
            - solaredge
        requestor:
          type: object
          description: Informações da empresa realizando cotação.
          required:
            - cnpj
            - email
          properties:
            cnpj:
              type: string
              description: CNPJ da empresa. Deve ser enviado somente números.
            email:
              type: string
              description: E-mail da empresa.
    Kit:
      type: object
      properties:
        name:
          type: string
        power:
          type: number
        price:
          type: number
        moduleBrand:
          type: string
        inverterBrand:
          type: string
        voltage:
          type: string
        structure:
          type: object
          properties:
            name:
              type: string
            type:
              type: string
              enum:
                - nenhuma
                - fibrocimento
                - laje_plana
                - metalica
                - solo
                - carport
                - ceramica
        products:
          type: array
          items:
            $ref: '#/components/schemas/KitItem'
    UnprocessableEntityError:
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          properties:
            error:
              type: object
              properties:
                cause:
                  type: string
                context:
                  type: array
                  items:
                    type: object
                    properties:
                      expected:
                        type: string
                      code:
                        type: string
                      received:
                        type: string
                      path:
                        type: array
                        items:
                          type: string
                      message:
                        type: string
    KitItem:
      oneOf:
        - $ref: '#/components/schemas/KitItemModule'
        - $ref: '#/components/schemas/KitItemInverter'
        - $ref: '#/components/schemas/KitItemBase'
      discriminator:
        propertyName: type
        mapping:
          module:
            $ref: '#/components/schemas/KitItemModule'
          inverter:
            $ref: '#/components/schemas/KitItemInverter'
          stringBox:
            $ref: '#/components/schemas/KitItemBase'
          complementaryEquipment:
            $ref: '#/components/schemas/KitItemBase'
    Error:
      type: object
      properties:
        success:
          type: boolean
        error:
          type: object
          properties:
            cause:
              type: string
              description: Causa do erro
            context:
              type: object
              description: Erro detalhado
      required:
        - success
        - error
    KitItemModule:
      allOf:
        - $ref: '#/components/schemas/KitItemBase'
        - type: object
          properties:
            attributes:
              type: object
              description: Atributos específicos do módulo
              properties:
                potencia_nominal_de_saida_KW:
                  type: number
                  description: Potência nominal de saída em kW
    KitItemInverter:
      allOf:
        - $ref: '#/components/schemas/KitItemBase'
        - type: object
          properties:
            attributes:
              type: object
              description: Atributos específicos do inversor
              properties:
                tipo_inversor:
                  type: string
                  enum:
                    - string
                    - micro
                    - hibrido
                    - solaredge
                tipo_ligacao:
                  type: string
                  enum:
                    - monofasico
                    - trifasico
                tensao_nominal_de_saida_V:
                  type: integer
                  description: Tensão nominal de saída em V
    KitItemBase:
      type: object
      required:
        - productCode
        - name
        - brand
        - model
        - amount
        - price
        - weight
        - width
        - height
        - depth
        - type
      properties:
        productCode:
          type: string
        name:
          type: string
        brand:
          type: string
        model:
          type: string
        amount:
          type: integer
        price:
          type: number
        weight:
          type: integer
        width:
          type: integer
        height:
          type: integer
        depth:
          type: integer
        type:
          type: string
          enum:
            - module
            - inverter
            - stringBox
            - complementaryEquipment
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: Authorization
    oauth:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://backend-pied-prod.piedadmin.com.br/api/oauth/token
          scopes:
            v2:kit:*: todas permissões para kits
            v2:kit:read: leitura em kits
            v2:kit:write: escreve em kits
            v2:kit:delete: remove kits

````