> 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 formats for country

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

Get all supported invoice formats for a specific country. Returns format identifiers, names, and MIME types.

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

## 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))

## Request

### Path parameters

- `countryCode` (enum, required) — ISO 3166-1 alpha-2 country code (lowercase). Determines country-specific validation and available e-invoice formats. Supported countries (37): ae, at, au, be, bg, ch, cy, cz, de, dk, ee, es, fi, fr, gb, gr, hr, hu, ie, is, it, jp, li, lt, lu, lv, mt, nl, no, nz, om, pl, pt, ro, se, si, sk.
  - Allowed values: `ae`, `at`, `au`, `be`, `bg`, `ch`, `cy`, `cz`, `de`, `dk`, `ee`, `es`, `fi`, `fr`, `gb`, `gr`, `hr`, `hu`, `ie`, `is`, `it`, `jp`, `li`, `lt`, `lu`, `lv`, `mt`, `nl`, `no`, `nz`, `om`, `pl`, `pt`, `ro`, `se`, `si`, `sk`

## Response

### 200

Country formats retrieved successfully

- `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 ApiV1InvoiceCountryCodeFormatsGetResponsesContentApplicationJsonSchemaFormatDetailsItems, required) — Per-format display metadata (label + kind) for the format tokens

## 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

### 404 Not Found Error

Not Found - Country not supported

- `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

### ApiV1InvoiceCountryCodeFormatsGetResponsesContentApplicationJsonSchemaFormatDetailsItems

- `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
{
  "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/de/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/de/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/de/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/de/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/de/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/de/formats', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://service.invoice-api.xhub.io/api/v1/invoice/de/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/de/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()
```