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

# Criar ordem de compra



## OpenAPI

````yaml https://erp.olist.com/public-api/v3/swagger/swagger-mintlify.json post /ordem-compra
openapi: 3.0.0
info:
  title: Olist ERP API v3
  description: >-
    Documentação completa: <a href="https://api-docs.erp.olist.com"
    target="_blank">https://api-docs.erp.olist.com</a>
  version: '3.1'
servers:
  - url: https://api.tiny.com.br/public-api/v3
security: []
paths:
  /ordem-compra:
    post:
      tags:
        - Ordem de Compra
      summary: Criar ordem de compra
      operationId: CriarOrdemCompraAction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CriarOrdemCompraModelRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CriarOrdemCompraModelResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDTO'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
        '503':
          description: Service Unavailable
      security:
        - bearerAuth: []
components:
  schemas:
    CriarOrdemCompraModelRequest:
      title: ' '
      description: ' '
      type: object
      allOf:
        - $ref: '#/components/schemas/CriarAtualizarOrdemCompraModelRequest'
        - required:
            - contato
          properties:
            contato:
              $ref: '#/components/schemas/ContatoRequestModel'
            categoria:
              $ref: '#/components/schemas/CategoriaRequestModel'
            frete:
              type: number
              format: float
              nullable: true
            itens:
              type: array
              items:
                $ref: '#/components/schemas/OrdemCompraItemModelRequest'
          type: object
    CriarOrdemCompraModelResponse:
      title: ' '
      description: ' '
      properties:
        id:
          type: integer
        numeroPedido:
          type: string
        data:
          type: string
        situacao:
          description: |-

            - 0 - Em Aberto
            - 1 - Atendido
            - 2 - Cancelado
            - 3 - Em Andamento
          type: string
          enum:
            - 0
            - 1
            - 2
            - 3
          nullable: true
          x-enumDescriptions:
            - 0 - Em Aberto
            - 1 - Atendido
            - 2 - Cancelado
            - 3 - Em Andamento
      type: object
    ErrorDTO:
      title: ' '
      description: ' '
      properties:
        mensagem:
          description: Mensagem de erro geral
          type: string
          example: Ocorreram erros de validação
        detalhes:
          description: Detalhes específicos do erro
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetailDTO'
          example:
            - campo: codigo
              mensagem: O campo código é obrigatório
          nullable: true
      type: object
    CriarAtualizarOrdemCompraModelRequest:
      title: ' '
      description: ' '
      properties:
        data:
          type: string
          example: '2024-01-01'
          nullable: true
        dataPrevista:
          type: string
          example: '2024-01-01'
          nullable: true
        desconto:
          type: number
          format: float
          nullable: true
        condicao:
          type: string
          nullable: true
        observacoes:
          type: string
          nullable: true
        observacoesInternas:
          type: string
          nullable: true
        fretePorConta:
          description: |-

            - R - Remetente
            - D - Destinatario
            - T - Terceiros
            - 3 - Proprio Remetente
            - 4 - Proprio Destinatario
            - S - Sem Transporte
          type: string
          enum:
            - R
            - D
            - T
            - '3'
            - '4'
            - S
          nullable: true
          x-enumDescriptions:
            - R - Remetente
            - D - Destinatario
            - T - Terceiros
            - 3 - Proprio Remetente
            - 4 - Proprio Destinatario
            - S - Sem Transporte
        transportador:
          type: string
          nullable: true
        parcelas:
          type: array
          items:
            $ref: '#/components/schemas/OrdemCompraParcelaModelRequest'
      type: object
    ContatoRequestModel:
      title: ' '
      description: ' '
      properties:
        id:
          type: integer
          nullable: true
      type: object
    CategoriaRequestModel:
      title: ' '
      description: ' '
      type: object
      allOf:
        - properties:
            id:
              type: integer
              nullable: true
          type: object
    OrdemCompraItemModelRequest:
      title: ' '
      description: ' '
      type: object
      allOf:
        - properties:
            produto:
              $ref: '#/components/schemas/ProdutoRequestModel'
            quantidade:
              type: number
              format: float
              nullable: true
            valor:
              type: number
              format: float
              nullable: true
            informacoesAdicionais:
              type: string
              nullable: true
            aliquotaIPI:
              type: number
              format: float
              nullable: true
            valorICMS:
              type: number
              format: float
              nullable: true
          type: object
    ErrorDetailDTO:
      title: ' '
      description: ' '
      properties:
        campo:
          description: Campo que gerou o erro
          type: string
          example: codigo
        mensagem:
          description: Mensagem de erro específica do campo
          type: string
          example: O campo código é obrigatório
      type: object
    OrdemCompraParcelaModelRequest:
      title: ' '
      description: ' '
      properties:
        dias:
          type: integer
        dataVencimento:
          type: string
          example: '2024-01-01'
        valor:
          type: number
          format: float
        contaContabil:
          $ref: '#/components/schemas/ContaContabilModel'
        meioPagamento:
          description: |-

            - 1 - Dinheiro
            - 2 - Cheque
            - 3 - Cartao Credito
            - 4 - Cartao Debito
            - 5 - Credito Loja
            - 10 - Vale Alimentacao
            - 11 - Vale Refeicao
            - 12 - Vale Presente
            - 13 - Vale Combustivel
            - 14 - Duplicata Mercantil
            - 15 - Boleto
            - 16 - Deposito Bancario
            - 17 - Pix
            - 18 - Transferencia Bancaria Carteira Digital
            - 19 - Fidelidade Cashback Credito Virtual
            - 20 - Pix Estatico
            - 90 - Sem Pagamento
            - 99 - Outros
          type: string
          enum:
            - 1
            - 2
            - 3
            - 4
            - 5
            - 10
            - 11
            - 12
            - 13
            - 14
            - 15
            - 16
            - 17
            - 18
            - 19
            - 20
            - 90
            - 99
          nullable: true
          x-enumDescriptions:
            - 1 - Dinheiro
            - 2 - Cheque
            - 3 - Cartao Credito
            - 4 - Cartao Debito
            - 5 - Credito Loja
            - 10 - Vale Alimentacao
            - 11 - Vale Refeicao
            - 12 - Vale Presente
            - 13 - Vale Combustivel
            - 14 - Duplicata Mercantil
            - 15 - Boleto
            - 16 - Deposito Bancario
            - 17 - Pix
            - 18 - Transferencia Bancaria Carteira Digital
            - 19 - Fidelidade Cashback Credito Virtual
            - 20 - Pix Estatico
            - 90 - Sem Pagamento
            - 99 - Outros
        observacoes:
          type: string
      type: object
    ProdutoRequestModel:
      title: ' '
      description: ' '
      type: object
      allOf:
        - properties:
            id:
              type: integer
              nullable: false
            tipo:
              description: |-

                - P - Produto
                - S - Servico
              type: string
              enum:
                - P
                - S
              nullable: true
              x-enumDescriptions:
                - P - Produto
                - S - Servico
          type: object
    ContaContabilModel:
      title: ' '
      description: ' '
      type: object
      allOf:
        - properties:
            id:
              type: integer
              nullable: true
          type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: Bearer

````