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

# Recibos Criptográficos SMLTP

> Obtenga el recibo de cumplimiento SMLTP firmado para completarlo

# Recibos de cumplimiento

Cuando una finalización se enruta a través de la **puerta de enlace SMLTP**, SecureAI produce un **recibo** de cumplimiento firmado: prueba criptográfica de la política que regía la llamada. Este endpoint recupera ese recibo por su identificación de paquete.

Los recibos existen solo para implementaciones enrutadas por puerta de enlace. En implementaciones de proveedor directo no hay una puerta de enlace para firmar recibos y este endpoint devuelve `404`.

## Endpoint

```
GET /receipts/:bundleId
```

## De dónde viene la identificación del paquete

Las respuestas de finalización exponen la identificación del paquete cada vez que se crea un derecho SMLTP para la llamada:

* Endpoint clásico: `metadata.smltp.bundle_id` (y un `metadata.smltp.receipt_url` ya preparado).
* Endpoint compatible con OpenAI: `secureai.smltp_bundle_id`.

La identificación del paquete (una identificación de derecho como `jti-…`) se devuelve incluso en implementaciones nativas/de proveedor directo. Sin embargo, el **recibo firmado** en esa identificación solo existe cuando el tráfico se enruta a través de la puerta de enlace SMLTP; en implementaciones directas, este endpoint devuelve `404` (ver más abajo).

## Autenticación

```bash theme={null}
Authorization: Bearer sk-your-api-key-here
```

## Ejemplo de solicitud

```bash theme={null}
curl -X GET "https://{customer.name}.hiperai.ai/api/external/receipts/bnd_9f2c...e71" \
  -H "Authorization: Bearer sk-your-api-key-here"
```

## Respuesta

### 200 bien

```json theme={null}
{
  "success": true,
  "receipt": {
    "bundle_id": "bnd_9f2c...e71",
    "...": "signed SMLTP receipt payload (policy, entitlement, verdict, signatures)"
  }
}
```

El objeto `receipt` es la carga útil firmada emitida por la puerta de enlace. Consulte [Seguridad SMLTP](/security/smltp) para saber cómo encajan los recibos en el modelo de transparencia y auditoría.

### 404 no encontrado

```json theme={null}
{
  "success": false,
  "error": "Receipt not found",
  "message": "No receipt for this bundle id. Receipts are only available when requests are routed through the SMLTP gateway, and are retained in its in-memory store for a limited time. The authoritative record is the hash-chained audit log."
}
```

### 400 Solicitud incorrecta

Se devuelve cuando falta la identificación del paquete o tiene más de 128 caracteres.

## Notas

* Los recibos se guardan en el almacén en memoria de la puerta de enlace por un tiempo limitado. Para obtener pruebas a largo plazo, confíe en el **registro de auditoría encadenado mediante hash**, el registro autorizado e inmutable. Consulte [Registros inmutables](/security/immutable-logs).
* No todas las rutas de implementación pasan por la puerta de enlace; Trate un `404` como "sin recibo de puerta de enlace para esta llamada", no como un error en su integración.

## Relacionado

* [Seguridad SMLTP](/seguridad/smltp)
* [Registros inmutables](/security/immutable-logs)
* [Finalización del chat](/api/chat/completions)


## OpenAPI

````yaml GET /receipts/{bundleId}
openapi: 3.0.3
info:
  title: SecureAI External API
  description: >
    SecureAI External API provides AI chat completion and image generation
    capabilities with knowledge base retrieval, 

    security policies, and comprehensive usage tracking. This API is designed
    for external developers 

    and integrations using API key authentication.


    ## Key Features

    - **RAG (Retrieval-Augmented Generation)**: Automatically search knowledge
    bases for relevant context

    - **Multi-Model Support**: OpenAI, Anthropic, Google, Meta, and other AI
    models

    - **Model Redundancy & Failover**: Caller-defined failover chains (primary +
    fallbacks) with per-attempt timeouts

    - **OpenAI-Compatible Endpoint**: Point any OpenAI SDK at `/api/external/v1`
    — no code changes

    - **Image Generation**: Generate and edit images using Google Gemini 2.5
    Flash Image

    - **Speech-to-Speech (S2S)**: Real-time voice conversations using OpenAI
    Realtime API with WebRTC

    - **Security Policies**: SMLTP policy enforcement, per-call Prompt Shield,
    and signed compliance receipts

    - **Usage Tracking**: Comprehensive usage monitoring, self-service quota,
    and rate limiting

    - **Knowledge Base Integration**: Access to personal and shared knowledge
    bases

    - **User Management**: Complete user, group, and role management
    capabilities

    - **Audit Logging**: Comprehensive activity and security audit logs


    ## Authentication

    All endpoints (except health check) require API key authentication using
    Bearer token:

    ```

    Authorization: Bearer sk-your-api-key-here

    ```


    ## Billing and Usage

    By default, API requests are billed to the user account that owns the API
    key. You can specify 

    a different user to bill by including the `user_id` parameter in your
    request. This allows for:

    - Multi-tenant applications with per-user billing

    - Flexible completion limit management

    - Per-user "Usage by Model" settings


    ## Rate Limits

    - Default: 60 requests per minute, 1000 requests per hour

    - Daily limits: 100 requests (configurable)

    - Monthly limits: 10,000 requests (configurable)


    ## Base URL

    ```

    https://secureai.hiperai.ai/api/external

    ```
  version: 1.1.0
  contact:
    name: SecureAI Support
    email: support@secureai.hiperai.ai
  license:
    name: Proprietary
    url: https://secureai.hiperai.ai/terms
servers:
  - url: https://secureai.hiperai.ai/api/external
    description: Production server
  - url: http://localhost:3010/api/external
    description: Development server
security:
  - ApiKeyAuth: []
tags:
  - name: System
    description: System health and status endpoints
  - name: Discovery
    description: Endpoints to discover available models, indexes, and policies
  - name: Chat
    description: AI chat completion endpoints
  - name: User Management
    description: Endpoints for managing user accounts and roles
  - name: Index Management
    description: Endpoints for managing knowledge base indexes
  - name: Group Management
    description: Endpoints for managing user groups
  - name: SMLTP Security
    description: Endpoints for managing SMLTP security policies and audit logs
  - name: Role Management
    description: Endpoints for managing user roles
  - name: Activity Logs
    description: Endpoints for retrieving activity logs
externalDocs:
  description: SecureAI Documentation
  url: https://secureai.hiperai.ai/docs
paths:
  /receipts/{bundleId}:
    get:
      tags:
        - Security
      summary: Fetch a signed SMLTP compliance receipt
      description: >
        Returns the signed compliance receipt for a gateway-routed completion.
        The

        bundle id is exposed on completion responses as
        `metadata.smltp.bundle_id`

        (classic) or `secureai.smltp_bundle_id` (/v1). Returns 404 on

        direct-provider deployments (no gateway to sign receipts).
      operationId: getReceipt
      parameters:
        - name: bundleId
          in: path
          required: true
          schema:
            type: string
            maxLength: 128
      responses:
        '200':
          description: The signed receipt object
        '400':
          description: Invalid bundle id
        '404':
          description: No receipt for this bundle id (or non-gateway deployment)
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: |
        API key authentication using Bearer token format.
        Example: `Authorization: Bearer sk-your-api-key-here`

````