> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.invoice-api.xhub.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.invoice-api.xhub.io/_mcp/server.

# Get all supported formats

GET https://service.invoice-api.xhub.io/api/v1/invoice/formats

Get all supported countries and their invoice formats. Useful for discovering available options before generating invoices.

Reference: https://docs.invoice-api.xhub.io/api-reference/formats/list

## Authentication

- `Authorization` header (bearer token, required) — API Key authentication. Use `sk_live_*` for production or `sk_test_*` for testing.

## Servers

- `https://service.invoice-api.xhub.io` (Invoice API v1 (production), default)
- `/` (Diese Instanz (lokale Entwicklung))

## Response

### 200

All formats retrieved successfully

- `countries` (list of ApiV1InvoiceFormatsGetResponsesContentApplicationJsonSchemaCountriesItems, required) — All supported countries and formats

## Errors

### 401 Unauthorized Error

Unauthorized - Invalid or missing API key

- `error` (string, required) — Error code
- `message` (string, required) — Human-readable error message
- `code` (string, optional) — Machine-readable reason, where one exists — e.g. `UNSUPPORTED_FORMAT_VERSION`, `UNSUPPORTED_FORMAT_PROFILE`, `CONFLICTING_FORMAT_OPTIONS`
- `field` (string, optional) — The request field the error refers to, where one exists

## Types

### ApiV1InvoiceFormatsGetResponsesContentApplicationJsonSchemaCountriesItems

- `code` (string, required) — Country code
- `name` (string, required) — Country name
- `label` (string, required) — Display label, e.g. 'Germany (DE)'
- `formats` (list of string, required) — Supported output format tokens, e.g. ['pdf', 'zugferd', 'xrechnung']
- `formatDetails` (list of ApiV1InvoiceFormatsGetResponsesContentApplicationJsonSchemaCountriesItemsFormatDetailsItems, required) — Per-format display metadata (label + kind) for the format tokens

### ApiV1InvoiceFormatsGetResponsesContentApplicationJsonSchemaCountriesItemsFormatDetailsItems

- `code` (string, required) — URL format token, e.g. 'zugferd', 'ubl'
- `label` (string, required) — Display label, e.g. 'ZUGFeRD 2.3/2.4/2.5'
- `kind` (enum, required) — Whether the format is PDF-based or an e-invoice
  - Allowed values: `pdf`, `einvoice`
- `parse` (boolean, optional) — false = generate-only format with no parse route (e.g. qr-bill: the Swiss Payments Code is a payment instruction, not machine-readable invoice data). Absent means parseable.
- `defaultVersion` (string, optional) — For hybrid formats (zugferd, facturx): the version the API writes when formatOptions.version is not sent.

## Examples

**Response**

```json
{
  "countries": [
    {
      "code": "string",
      "name": "string",
      "label": "string",
      "formats": [
        "string"
      ],
      "formatDetails": [
        {
          "code": "string",
          "label": "string",
          "kind": "pdf",
          "parse": true,
          "defaultVersion": "string"
        }
      ]
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://service.invoice-api.xhub.io/api/v1/invoice/formats"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://service.invoice-api.xhub.io/api/v1/invoice/formats';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://service.invoice-api.xhub.io/api/v1/invoice/formats"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://service.invoice-api.xhub.io/api/v1/invoice/formats")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://service.invoice-api.xhub.io/api/v1/invoice/formats")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://service.invoice-api.xhub.io/api/v1/invoice/formats', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://service.invoice-api.xhub.io/api/v1/invoice/formats");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://service.invoice-api.xhub.io/api/v1/invoice/formats")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```