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

# Obtener devolución específica



## OpenAPI

````yaml /openapi.yaml get /returns/{id}
openapi: 3.0.0
info:
  title: SmartPYME External API
  description: >
    API Externa de SmartPYME para proveedores terceros.


    Permite consultar y registrar ventas, consultar inventario y devoluciones, e
    importar paquetes usando autenticación por API Key.


    ## Autenticación

    Todas las requests requieren un API Key válido en el header Authorization:

    ```

    Authorization: Bearer {tu_api_key}

    ```


    ## Rate Limiting

    - Sin filtros de fecha: 1000 requests/hora

    - Con filtros de fecha: 2000 requests/hora


    ## Paginación

    Todos los endpoints de lista soportan paginación:

    - `page`: Número de página (default: 1)

    - `per_page`: Registros por página (1-200, default: 100)
  version: 1.4.0
  contact:
    name: SmartPYME Support
    email: soporte@smartpyme.com
  license:
    name: Propietario
    url: https://smartpyme.com/terms
servers:
  - url: https://tu-dominio.com/api/external/v1
    description: Servidor de Producción
  - url: http://localhost/api/external/v1
    description: Servidor de Desarrollo
security:
  - ApiKeyAuth: []
paths:
  /returns/{id}:
    get:
      tags:
        - Devoluciones
      summary: Obtener devolución específica
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            example: 789
      responses:
        '200':
          description: Devolución obtenida exitosamente
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    ReturnResponse:
      allOf:
        - $ref: '#/components/schemas/BaseResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/Return'
    BaseResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Indica si la operación fue exitosa
        meta:
          $ref: '#/components/schemas/Meta'
      required:
        - success
    Return:
      type: object
      properties:
        id:
          type: integer
        fecha:
          type: string
          format: date
        correlativo:
          type: string
        tipo:
          type: string
        sub_total:
          type: number
        total:
          type: number
        iva:
          type: number
        observaciones:
          type: string
        estado:
          type: string
          enum:
            - Confirmada
            - Anulada
        id_venta:
          type: integer
        nombre_cliente:
          type: string
        nombre_usuario:
          type: string
        nombre_documento:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        detalles:
          type: array
          items:
            $ref: '#/components/schemas/ReturnDetail'
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          description: Mensaje de error
        code:
          type: integer
          description: Código de error HTTP
      required:
        - success
        - error
        - code
    Meta:
      type: object
      properties:
        empresa:
          type: string
          description: Nombre de la empresa
          example: Mi Empresa S.A.
        timestamp:
          type: string
          format: date-time
          description: Timestamp de la respuesta
        filters_applied:
          type: object
          description: Filtros aplicados en la consulta
      required:
        - empresa
        - timestamp
    ReturnDetail:
      type: object
      properties:
        nombre_producto:
          type: string
        codigo_producto:
          type: string
        marca_producto:
          type: string
        cantidad:
          type: number
        precio:
          type: number
        total:
          type: number
  responses:
    Unauthorized:
      description: API Key inválido o faltante
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error: API key inválido o empresa inactiva
            code: 401
    NotFound:
      description: Recurso no encontrado
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error: Venta no encontrada
            code: 404
    InternalServerError:
      description: Error interno del servidor
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error: Error interno del servidor
            code: 500
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: |
        API Key de la empresa en formato Bearer token.

        Ejemplo: `Authorization: Bearer G8RCjH11DabBNjnX7wO5`

````