Appearance
Endpoint
POST /v1/generate/ciiAuthentication
This endpoint requires Bearer Token Authentication via Laravel Sanctum.
bash
Authorization: Bearer YOUR_API_TOKENRequest Body
The request body must contain a DocumentData object in JSON format.
INFO
All endpoints use the same DocumentData structure. See Data Structures for details.
Content-Type
Content-Type: application/jsonMinimal Example
json
{
"document_number": "INV-2024-001",
"date": "2024-01-15",
"due_date": "2024-02-15",
"type": "380",
"currency_code": "EUR",
"profile": 1,
"recipient": {
"name": "Example Corp Ltd",
"street": "123 Sample St",
"zip": "10001",
"city": "New York",
"country_code": "US"
},
"items": [
{
"description": "Web Development",
"quantity": 10,
"unit_price": 100.00,
"tax_type": "S",
"tax_rate": 20,
"unit_code": "HUR",
"price_base_quantity": 1
}
]
}Complete Example
json
{
"document_number": "INV-2024-001",
"date": "2024-01-15",
"due_date": "2024-02-15",
"type": "380",
"currency_code": "EUR",
"profile": 1,
"language_code": "en",
"buyer_reference": "PO-123",
"order_reference": "ORDER-456",
"payment_means_code": "30",
"recipient": {
"name": "Example Client Ltd",
"contact_person": "John Doe",
"street": "123 Client Road",
"zip": "SW1A 1AA",
"city": "London",
"country_code": "GB",
"email": "john@example.com",
"phone": "+44 20 7123 4567",
"vat_id": "GB123456789"
},
"pdf_presentation": {
"theme": "modern",
"with_giro_code": false,
"currency_as_symbol": true,
"primary_color": "#3b82f6"
},
"sender": {
"company_name": "Your Company Ltd",
"street": "1 Business Park",
"zip": "M1 1AA",
"city": "Manchester",
"country_code": "GB",
"vat_id": "GB987654321",
"email": "info@yourcompany.com",
"phone": "+44 161 987 6543",
"iban": "GB29370400440532013000",
"bic": "NWBKGB22",
"bank_name": "NatWest Bank"
},
"items": [
{
"description": "Web Development Premium Package",
"quantity": 10,
"unit_price": 100.00,
"tax_type": "S",
"tax_rate": 20,
"unit_code": "HUR",
"price_base_quantity": 1,
"seller_item_identifier": "WEB-PREMIUM-001",
"attributes": {
"note": "Development of main landing page"
}
}
],
"intro_text": "Thank you for your order.",
"outro_text": "We look forward to working with you again.",
"cash_discount_days": 14,
"cash_discount_percent": 2
}Response
Success Response
Status Code: 200 OK
Content-Type: application/xml
CII XML document
Error Responses
Validation Error
Status Code: 422 Unprocessable Entity
json
{
"message": "The given data was invalid.",
"errors": {
"document_number": ["The document_number field is required."],
"items": ["At least one item is required."]
}
}Authentication Error
Status Code: 401 Unauthorized
json
{
"message": "Unauthenticated."
}Rate Limit
Status Code: 429 Too Many Requests
json
{
"message": "Too many requests."
}Code Examples
bash
curl -X POST \
https://api.example.com/v1/generate/cii \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d @request.jsonphp
<?php
$client = new \GuzzleHttp\Client();
$response = $client->post('https://api.example.com/v1/generate/cii', [
'headers' => [
'Authorization' => 'Bearer ' . $apiToken,
'Content-Type' => 'application/json',
],
'json' => [
'document_number' => 'INV-2024-001',
'date' => '2024-01-15',
'due_date' => '2024-02-15',
'type' => '380',
'currency_code' => 'EUR',
'profile' => 1,
'recipient' => [
'name' => 'Example Client Ltd',
'street' => '123 Client Road',
'zip' => 'SW1A 1AA',
'city' => 'London',
'country_code' => 'GB',
],
'items' => [
[
'description' => 'Web Development',
'quantity' => 10,
'unit_price' => 100.00,
'tax_type' => 'S',
'tax_rate' => 20,
'unit_code' => 'HUR',
'price_base_quantity' => 1,
],
],
],
]);
file_put_contents('invoice.xml', $response->getBody());javascript
const response = await fetch('https://api.example.com/v1/generate/cii', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
document_number: 'INV-2024-001',
date: '2024-01-15',
due_date: '2024-02-15',
type: '380',
currency_code: 'EUR',
profile: 1,
recipient: {
name: 'Example Client Ltd',
street: '123 Client Road',
zip: 'SW1A 1AA',
city: 'London',
country_code: 'GB',
},
items: [{
description: 'Web Development',
quantity: 10,
unit_price: 100.00,
tax_type: 'S',
tax_rate: 20,
unit_code: 'HUR',
price_base_quantity: 1,
}],
}),
});
const blob = await response.blob();
// Process blob...python
import requests
headers = {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json',
}
data = {
'document_number': 'INV-2024-001',
'date': '2024-01-15',
'due_date': '2024-02-15',
'type': '380',
'currency_code': 'EUR',
'profile': 1,
'recipient': {
'name': 'Example Client Ltd',
'street': '123 Client Road',
'zip' => 'SW1A 1AA',
'city': 'London',
'country_code': 'GB',
},
'items': [{
'description': 'Web Development',
'quantity': 10,
'unit_price': 100.00,
'tax_type': 'S',
'tax_rate: 20,
'unit_code': 'HUR',
'price_base_quantity': 1,
}],
}
response = requests.post(
'https://api.example.com/v1/generate/cii',
headers=headers,
json=data
)
with open('invoice.xml', 'wb') as f:
f.write(response.content)