# Retrieve invoice Retrieve a specific invoice by ID. Non-staff users can only access their organization's invoices. #### Path Parameters **`invoice_id`** string required Invoice ID (format: `inv_`). ## Returns Returns the complete invoice object including all line items, tax calculations, and metadata. ```bash curl "https://api.aitronos.com/v1/invoices/inv_123e4567e89b12d3a456426614174000" \ -H "X-API-Key: $FREDDY_API_KEY" ``` ```python import os import requests api_key = os.environ["FREDDY_API_KEY"] invoice_id = "inv_123e4567e89b12d3a456426614174000" response = requests.get( f"https://api.aitronos.com/v1/invoices/{invoice_id}", headers={"X-API-Key": api_key} ) invoice = response.json() print(f"Invoice: {invoice['invoice_number']}") print(f"Total: CHF {invoice['total_amount']}") print(f"Status: {invoice['status']}") ``` ```javascript const invoiceId = "inv_123e4567e89b12d3a456426614174000"; const response = await fetch( `https://api.aitronos.com/v1/invoices/${invoiceId}`, { headers: { "X-API-Key": process.env.FREDDY_API_KEY } } ); const invoice = await response.json(); console.log(`Invoice: ${invoice.invoice_number}`); console.log(`Total: CHF ${invoice.total_amount}`); console.log(`Status: ${invoice.status}`); ``` **Response:** 200 OK ```json { "id": "inv_123e4567e89b12d3a456426614174000", "invoice_number": "INV-2024-12-AIT-001", "organization_id": "org_123e4567e89b12d3a456426614174000", "organization_name": "Aitronos AG", "billing_period_start": "2024-12-01T00:00:00Z", "billing_period_end": "2025-01-01T00:00:00Z", "issue_date": "2024-12-31T23:59:59Z", "due_date": "2025-01-30T23:59:59Z", "payment_date": null, "currency": "CHF", "exchange_rate": 1.0, "subtotal": 1250.50, "tax_rate": 0.081, "tax_amount": 101.29, "total_amount": 1351.79, "status": "issued", "items": [ { "id": "invitem_123e4567e89b12d3a456426614174000", "description": "GPT-4 Turbo - Input Tokens", "model_name": "gpt-4-turbo", "provider": "openai", "quantity": 1250.5, "unit": "1K tokens", "unit_price": 0.01, "amount": 12.51, "input_tokens": 1250500, "output_tokens": null, "total_requests": 1523 } ], "created_at": "2024-12-31T23:59:59Z", "updated_at": "2024-12-31T23:59:59Z" } ``` 401 Unauthorized ```json { "success": false, "error": { "code": "AUTHENTICATION_REQUIRED", "message": "Authentication required", "system_message": "Missing or invalid authentication token", "type": "client_error", "status": 401, "details": {}, "trace_id": "2fbbf3b6-51a1-4f1b-88e2-c00e8b52fbb8", "timestamp": "2025-11-26T08:21:45Z" } } ``` 403 Forbidden ```json { "success": false, "error": { "code": "ORGANIZATION_ACCESS_DENIED", "message": "You don't have permission to access this invoice", "system_message": "User cannot access this organization's invoices", "type": "client_error", "status": 403, "details": { "invoice_id": "inv_123e4567e89b12d3a456426614174000" }, "trace_id": "2fbbf3b6-51a1-4f1b-88e2-c00e8b52fbb8", "timestamp": "2025-11-26T08:21:45Z" } } ``` 404 Not Found ```json { "success": false, "error": { "code": "INVOICE_NOT_FOUND", "message": "Invoice not found", "system_message": "Invoice does not exist", "type": "client_error", "status": 404, "details": { "invoice_id": "inv_123e4567e89b12d3a456426614174000" }, "trace_id": "2fbbf3b6-51a1-4f1b-88e2-c00e8b52fbb8", "timestamp": "2025-11-26T08:21:45Z" } } ```