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

# Crear presupuesto

> Crea un presupuesto en borrador. La API asigna el número, calcula importes y administra la reserva opcional. Requiere Idempotency-Key.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/quotes
openapi: 3.1.0
info:
  title: La Pyme API
  description: >-
    Resources and workflows for purchases, sales, inventory, contacts, products,
    reports, and settings.
  version: 1.0.0
  contact:
    name: La Pyme Support
    email: hola@lapyme.com.ar
  license:
    name: Proprietary
    url: https://lapyme.com.ar/terminos
servers:
  - url: https://api.lapyme.com.ar
    description: Servidor de producción
security:
  - bearerAuth: []
tags:
  - name: API
    description: Public API operations for La Pyme integrations.
paths:
  /api/v1/quotes:
    post:
      tags:
        - API
      summary: Crear presupuesto
      description: >-
        Crea un presupuesto en borrador. La API asigna el número, calcula
        importes y administra la reserva opcional. Requiere Idempotency-Key.
      operationId: createApiQuote
      parameters:
        - name: Idempotency-Key
          in: header
          description: Clave estable para deduplicar reintentos de la misma operación.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiQuoteRequest'
      responses:
        '201':
          description: Presupuesto creado o reproducido idempotentemente
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiQuoteWriteResponse'
        '400':
          description: Solicitud o Idempotency-Key inválidos
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: Solicitud o Idempotency-Key inválidos
                      retryable: false
                      details: []
        '401':
          description: API key faltante o inválida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: API key faltante o inválida
                      retryable: false
                      details: []
        '403':
          description: Scope quotes:write faltante
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: Scope quotes:write faltante
                      retryable: false
                      details: []
        '404':
          description: Presupuesto o referencia no encontrados
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: Presupuesto o referencia no encontrados
                      retryable: false
                      details: []
        '409':
          description: Conflicto de idempotencia o presupuesto fuera de estado borrador
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: >-
                        Conflicto de idempotencia o presupuesto fuera de estado
                        borrador
                      retryable: false
                      details: []
        '422':
          description: No se pudo reservar stock por una condición de negocio
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: No se pudo reservar stock por una condición de negocio
                      retryable: false
                      details: []
        '429':
          description: Límite de solicitudes excedido para la organización
          headers:
            Retry-After:
              description: Segundos a esperar antes de volver a intentar la solicitud.
              schema:
                type: string
                example: '30'
            X-RateLimit-Limit:
              description: Límite de la ventana activa.
              schema:
                type: string
                example: '5000'
            X-RateLimit-Remaining:
              description: Solicitudes restantes en la ventana activa.
              schema:
                type: string
                example: '0'
            X-RateLimit-Reset:
              description: Segundos restantes hasta el reset de la ventana activa.
              schema:
                type: string
                example: '30'
            RateLimit-Limit:
              description: Límite de la ventana activa en formato estándar.
              schema:
                type: string
                example: '5000'
            RateLimit-Remaining:
              description: Solicitudes restantes en la ventana activa en formato estándar.
              schema:
                type: string
                example: '0'
            RateLimit-Reset:
              description: >-
                Segundos hasta el reset de la ventana activa en formato
                estándar.
              schema:
                type: string
                example: '30'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: RATE_LIMITED
                  value:
                    request_id: req_rate_limit_1
                    error:
                      type: rate_limit_error
                      code: RATE_LIMITED
                      message: >-
                        The organization request limit was reached. Try again
                        later.
                      retryable: true
                      details: []
        '500':
          description: Error interno del servidor
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: INVALID_REQUEST
                  value:
                    request_id: req_error_1
                    error:
                      type: invalid_request_error
                      code: INVALID_REQUEST
                      message: Error interno del servidor
                      retryable: false
                      details: []
components:
  schemas:
    ApiQuoteRequest:
      type: object
      properties:
        customer_id:
          type: string
          format: uuid
        price_list_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
        salesperson_member_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
        items:
          minItems: 1
          type: array
          items:
            type: object
            properties:
              product_id:
                type: string
                format: uuid
              warehouse_id:
                anyOf:
                  - type: string
                    format: uuid
                  - type: 'null'
              quantity:
                type: integer
                exclusiveMinimum: 0
              unit_price:
                type: integer
                minimum: 0
              discount:
                oneOf:
                  - type: object
                    properties:
                      type:
                        type: string
                        const: percentage
                      value:
                        type: number
                        minimum: 0
                        maximum: 100
                    required:
                      - type
                      - value
                    additionalProperties: false
                  - type: object
                    properties:
                      type:
                        type: string
                        const: amount
                      value:
                        type: integer
                        minimum: 0
                    required:
                      - type
                      - value
                    additionalProperties: false
            required:
              - product_id
              - quantity
              - unit_price
            additionalProperties: false
        expires_at:
          anyOf:
            - type: string
              format: date
            - type: 'null'
        global_discount_amount:
          type: integer
          minimum: 0
        notes:
          anyOf:
            - type: string
            - type: 'null'
        reservation:
          type: object
          properties:
            enabled:
              type: boolean
            reserved_through_date:
              type: string
              format: date
          required:
            - enabled
          additionalProperties: false
      required:
        - customer_id
        - items
      additionalProperties: false
    ApiQuoteWriteResponse:
      type: object
      properties:
        request_id:
          type: string
        data:
          type: object
          properties:
            object:
              type: string
              const: quote
            id:
              type: string
              format: uuid
            number:
              type: integer
              exclusiveMinimum: 0
            formatted_number:
              type: string
            customer_id:
              type: string
              format: uuid
            status:
              $ref: '#/components/schemas/ApiSharedEnumfbc137f7cc'
            converted_sale_id:
              anyOf:
                - type: string
                  format: uuid
                - type: 'null'
            reservation:
              anyOf:
                - $ref: '#/components/schemas/ApiSharedObjectc82a2ff2d4'
                - type: 'null'
            subtotal:
              type: integer
              minimum: 0
            tax_amount:
              type: integer
              minimum: 0
            discount_amount:
              type: integer
              minimum: 0
            total:
              type: integer
              minimum: 0
            created_at:
              type: string
              format: date-time
            updated_at:
              type: string
              format: date-time
            salesperson_member_id:
              anyOf:
                - type: string
                  format: uuid
                - type: 'null'
            price_list_id:
              anyOf:
                - type: string
                  format: uuid
                - type: 'null'
            prices_include_tax:
              anyOf:
                - type: boolean
                - type: 'null'
            expires_at:
              anyOf:
                - type: string
                  format: date-time
                - type: 'null'
            notes:
              anyOf:
                - type: string
                - type: 'null'
            items:
              type: array
              items:
                $ref: '#/components/schemas/ApiSharedObjecta51cd840c4'
            idempotent_replay:
              type: boolean
          required:
            - object
            - id
            - number
            - formatted_number
            - customer_id
            - status
            - converted_sale_id
            - reservation
            - subtotal
            - tax_amount
            - discount_amount
            - total
            - created_at
            - updated_at
            - salesperson_member_id
            - price_list_id
            - prices_include_tax
            - expires_at
            - notes
            - items
            - idempotent_replay
          additionalProperties: false
        warnings:
          type: array
          items:
            type: object
            properties:
              product_id:
                type: string
                format: uuid
              warehouse_id:
                type: string
                format: uuid
              requested_quantity:
                type: number
              available_quantity:
                type: number
            required:
              - product_id
              - warehouse_id
              - requested_quantity
              - available_quantity
            additionalProperties: false
      required:
        - request_id
        - data
        - warnings
      additionalProperties: false
    ApiErrorEnvelope:
      type: object
      properties:
        request_id:
          type: string
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - api_error
                - authentication_error
                - authorization_error
                - business_error
                - external_dependency_error
                - idempotency_error
                - invalid_request_error
                - rate_limit_error
            code:
              type: string
            message:
              type: string
            retryable:
              type: boolean
            details:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                  metadata:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: number
                        - type: boolean
                        - type: 'null'
                required:
                  - code
                  - message
                additionalProperties: false
          required:
            - type
            - code
            - message
            - retryable
            - details
          additionalProperties: false
      required:
        - request_id
        - error
      additionalProperties: false
    ApiSharedEnumfbc137f7cc:
      type: string
      enum:
        - draft
        - sent
        - accepted
        - rejected
        - expired
        - converted
    ApiSharedObjectc82a2ff2d4:
      type: object
      properties:
        status:
          type: string
          const: active
        reserved_through_date:
          type: string
          format: date
      required:
        - status
        - reserved_through_date
      additionalProperties: false
    ApiSharedObjecta51cd840c4:
      type: object
      properties:
        object:
          type: string
          const: quote_line
        id:
          type: string
          format: uuid
        product_id:
          type: string
          format: uuid
        warehouse_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
        quantity:
          type: number
          exclusiveMinimum: 0
        unit_price:
          type: integer
          minimum: 0
        discount:
          anyOf:
            - $ref: '#/components/schemas/ApiSharedObject0141f82a97'
            - type: 'null'
      required:
        - object
        - id
        - product_id
        - warehouse_id
        - quantity
        - unit_price
        - discount
      additionalProperties: false
    ApiSharedObject0141f82a97:
      type: object
      properties:
        type:
          type: string
          const: percentage
        value:
          type: number
          minimum: 0
      required:
        - type
        - value
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Incluí tu API key en el header Authorization con el prefijo Bearer.

````