> ## 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 transferencia de stock

> Crea una transferencia para mover productos entre depósitos.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/stock-transfers
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/stock-transfers:
    post:
      tags:
        - API
      summary: Crear transferencia de stock
      description: Crea una transferencia para mover productos entre depósitos.
      operationId: createApiStockTransfer
      parameters:
        - name: Idempotency-Key
          in: header
          description: >-
            Clave opcional para deduplicar reintentos de la misma creación de
            transferencia. Si se omite, no hay protección automática contra
            repeticiones.
          required: false
          schema:
            type: string
        - name: X-Request-Id
          in: header
          description: >-
            ID opcional de la solicitud para trazabilidad. Si se omite, el
            servidor genera uno.
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiStockTransferRequest'
      responses:
        '200':
          description: Transferencia creada exitosamente
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiStockTransferSuccessResponse'
              examples:
                created:
                  summary: Transferencia creada
                  value:
                    request_id: req_transfer_commit_1
                    data:
                      transfer:
                        id: cf19b3ae-4c08-48be-b9d7-e6f2f5baf609
                        organization_id: 550e8400-e29b-41d4-a716-446655440001
                        source_warehouse_id: 550e8400-e29b-41d4-a716-446655440010
                        target_warehouse_id: 550e8400-e29b-41d4-a716-446655440011
                        transfer_date: '2026-04-18T13:00:00.000Z'
                        notes: Storefront replenishment
                        status: in_transit
                        created_at: '2026-04-18T13:00:00.000Z'
                        updated_at: '2026-04-18T13:05:00.000Z'
                        created_by: 550e8400-e29b-41d4-a716-446655440020
                        updated_by: 550e8400-e29b-41d4-a716-446655440020
                        source_warehouse:
                          id: 550e8400-e29b-41d4-a716-446655440010
                          name: Central warehouse
                        target_warehouse:
                          id: 550e8400-e29b-41d4-a716-446655440011
                          name: Showroom
                        items:
                          - id: 550e8400-e29b-41d4-a716-446655440030
                            product_id: 550e8400-e29b-41d4-a716-446655440040
                            quantity: 5
                            received_quantity: 0
                            rejected_quantity: 0
                            product:
                              id: 550e8400-e29b-41d4-a716-446655440040
                              name: Cable HDMI 2m
                              sku: HDMI-2M
                              variant_options: null
                              option_names: []
                      idempotent_replay: false
                    warnings: []
        '400':
          description: Payload inválido o validación de negocio fallida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: VALIDATION_ERROR
                  value:
                    request_id: req_transfer_1
                    error:
                      code: VALIDATION_ERROR
                      message: Source and target warehouses must be different
                      retryable: false
                      details:
                        - field: source_warehouse_id
                          code: VALIDATION
                          message: >-
                            The source warehouse must be different from the
                            target warehouse.
                      type: invalid_request_error
        '401':
          description: API key faltante o inválida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: AUTHENTICATION_REQUIRED
                  value:
                    request_id: req_transfer_1
                    error:
                      code: AUTHENTICATION_REQUIRED
                      message: API key is required in the Authorization header
                      retryable: false
                      type: invalid_request_error
                      details: []
        '403':
          description: Scopes insuficientes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: FORBIDDEN
                  value:
                    request_id: req_transfer_1
                    error:
                      code: FORBIDDEN
                      message: Your API key does not have permission for this operation
                      retryable: false
                      type: invalid_request_error
                      details: []
        '404':
          description: Recurso relacionado inexistente
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: NOT_FOUND
                  value:
                    request_id: req_transfer_1
                    error:
                      code: NOT_FOUND
                      message: Transfer not found
                      retryable: false
                      type: invalid_request_error
                      details: []
        '409':
          description: >-
            Conflicto de stock o de idempotencia cuando se reutiliza una clave
            distinta
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
              examples:
                default:
                  summary: CONFLICT
                  value:
                    request_id: req_transfer_1
                    error:
                      code: CONFLICT
                      message: Stock insuficiente para transferir 5 unidades.
                      retryable: false
                      details:
                        - field: items
                          code: CONFLICT
                          message: Stock insuficiente para transferir 5 unidades.
                      type: invalid_request_error
        '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: INTERNAL_ERROR
                  value:
                    request_id: req_transfer_1
                    error:
                      code: INTERNAL_ERROR
                      message: Could not process the stock transfer
                      retryable: false
                      type: invalid_request_error
                      details: []
components:
  schemas:
    ApiStockTransferRequest:
      type: object
      properties:
        source_warehouse_id:
          type: string
          format: uuid
        target_warehouse_id:
          type: string
          format: uuid
        transfer_date:
          type: string
          format: date-time
        notes:
          type: string
        items:
          minItems: 1
          maxItems: 500
          type: array
          items:
            type: object
            properties:
              product_id:
                type: string
                format: uuid
              quantity:
                type: integer
                minimum: 1
            required:
              - product_id
              - quantity
            additionalProperties: false
        save_as_draft:
          type: boolean
        mark_as_received:
          type: boolean
      required:
        - source_warehouse_id
        - target_warehouse_id
        - transfer_date
        - items
      additionalProperties: false
    ApiStockTransferSuccessResponse:
      type: object
      properties:
        request_id:
          type: string
        data:
          type: object
          properties:
            transfer:
              type: object
              properties:
                id:
                  type: string
                  format: uuid
                organization_id:
                  type: string
                  format: uuid
                source_warehouse_id:
                  type: string
                  format: uuid
                target_warehouse_id:
                  type: string
                  format: uuid
                transfer_number:
                  anyOf:
                    - type: integer
                      exclusiveMinimum: 0
                    - type: 'null'
                formatted_transfer_number:
                  anyOf:
                    - type: string
                    - type: 'null'
                transfer_date:
                  type: string
                  format: date-time
                notes:
                  anyOf:
                    - type: string
                    - type: 'null'
                status:
                  $ref: '#/components/schemas/ApiSharedEnum736f0d077b'
                created_at:
                  type: string
                  format: date-time
                updated_at:
                  type: string
                  format: date-time
                created_by:
                  type: string
                updated_by:
                  anyOf:
                    - type: string
                    - type: 'null'
                source_warehouse:
                  $ref: '#/components/schemas/ApiSharedObject8aeeceaf0f'
                target_warehouse:
                  $ref: '#/components/schemas/ApiSharedObject8aeeceaf0f'
                items:
                  type: array
                  items:
                    $ref: '#/components/schemas/ApiSharedObject9090c617d7'
              required:
                - id
                - organization_id
                - source_warehouse_id
                - target_warehouse_id
                - transfer_number
                - formatted_transfer_number
                - transfer_date
                - notes
                - status
                - created_at
                - updated_at
                - created_by
                - updated_by
                - source_warehouse
                - target_warehouse
                - items
              additionalProperties: false
            idempotent_replay:
              type: boolean
          required:
            - transfer
            - idempotent_replay
          additionalProperties: false
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/ApiSharedObjectc671832641'
      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:
                $ref: '#/components/schemas/ApiSharedObjectc671832641'
          required:
            - type
            - code
            - message
            - retryable
            - details
          additionalProperties: false
      required:
        - request_id
        - error
      additionalProperties: false
    ApiSharedEnum736f0d077b:
      type: string
      enum:
        - draft
        - in_transit
        - completed
        - closed_with_difference
        - cancelled
    ApiSharedObject8aeeceaf0f:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
      required:
        - id
        - name
      additionalProperties: false
    ApiSharedObject9090c617d7:
      type: object
      properties:
        id:
          type: string
          format: uuid
        product_id:
          type: string
          format: uuid
        quantity:
          type: number
          exclusiveMinimum: 0
        received_quantity:
          type: number
          minimum: 0
        rejected_quantity:
          type: number
          minimum: 0
        product:
          $ref: '#/components/schemas/ApiSharedObject5970f757f8'
      required:
        - id
        - product_id
        - quantity
        - received_quantity
        - rejected_quantity
        - product
      additionalProperties: false
    ApiSharedObjectc671832641:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        field:
          type: string
      required:
        - code
        - message
      additionalProperties: false
    ApiSharedObject5970f757f8:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        sku:
          type: string
        variant_options:
          anyOf:
            - type: object
              propertyNames:
                type: string
              additionalProperties:
                type: string
            - type: 'null'
        option_names:
          anyOf:
            - type: array
              items:
                type: string
            - type: 'null'
      required:
        - id
        - name
        - sku
        - variant_options
        - option_names
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Incluí tu API key en el header Authorization con el prefijo Bearer.

````