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

# Submit the monthly LROE Capítulo 1.1 batch (ES, Bizkaia)

POST https://service.invoice-api.xhub.io/api/v1/lroe/submit
Content-Type: application/json

Aggregates the accepted TicketBAI submissions of the month and files them as one LROE Modelo-240 Capítulo 1.1 batch with BATUZ. Requires a TicketBAI Bizkaia credential with razón social, stored with `POST /api/v1/gov-credentials` (countryCode 'ES', systemKey 'tbai-bizkaia').

Reference: https://docs.invoice-api.xhub.io/api-reference/lroe/post-api-v-1-lroe-submit

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

### Body (application/json)

This endpoint expects an object.

- `year` (integer, required) — Fiscal year of the filing period.
- `month` (integer, required) — Month of the filing period (1–12).
- `environment` (enum, optional) — BATUZ environment. Defaults to `test`.
  - Allowed values: `test`, `prod`

## Response

### 200

The gateway accepted the batch (`Correcto`).

- `success` (boolean, required) — True when the gateway answered `Correcto`.
- `tipoRespuesta` (enum, required) — Gateway verdict for the whole batch.
  - Allowed values: `Correcto`, `Parcialmente correcto`, `Incorrecto`
- `altaCount` (integer, required) — Number of invoice registrations (alta) in the batch.
- `anulacionCount` (integer, required) — Number of cancellations (anulación) in the batch.
- `rawResponse` (string, required) — Raw gateway response.
- `httpStatus` (integer, required) — HTTP status of the gateway call (0 when no call was needed).
- `identificativo` (string, optional) — Gateway identifier of the filing.
- `numeroRegistro` (string, optional) — Registration number assigned by the gateway.
- `errorCode` (string, optional) — Gateway error code when the batch was rejected.
- `errorMessage` (string, optional) — Gateway error text when the batch was rejected.

### 207

The gateway accepted part of the batch (`Parcialmente correcto`).

- `success` (boolean, required) — True when the gateway answered `Correcto`.
- `tipoRespuesta` (enum, required) — Gateway verdict for the whole batch.
  - Allowed values: `Correcto`, `Parcialmente correcto`, `Incorrecto`
- `altaCount` (integer, required) — Number of invoice registrations (alta) in the batch.
- `anulacionCount` (integer, required) — Number of cancellations (anulación) in the batch.
- `rawResponse` (string, required) — Raw gateway response.
- `httpStatus` (integer, required) — HTTP status of the gateway call (0 when no call was needed).
- `identificativo` (string, optional) — Gateway identifier of the filing.
- `numeroRegistro` (string, optional) — Registration number assigned by the gateway.
- `errorCode` (string, optional) — Gateway error code when the batch was rejected.
- `errorMessage` (string, optional) — Gateway error text when the batch was rejected.

## Errors

### 400 Bad Request Error

The body is not a JSON object, or year, month or environment is invalid.

- `success` (false, required)
- `error` (list of RequestValidationErrorErrorItems, required)

### 401 Unauthorized Error

Missing or invalid API key.

- `any`

### 409 Conflict Error

The organization has not set up LROE filing: no TicketBAI Bizkaia credential, or the credential has no razón social.

- `error` (enum, required) — `LROE_CREDENTIAL_MISSING`: no TicketBAI Bizkaia credential stored. `LROE_NRS_MISSING`: the credential has no razón social.
  - Allowed values: `LROE_CREDENTIAL_MISSING`, `LROE_NRS_MISSING`
- `message` (string, required) — What to set up, naming the endpoint that stores the credential.

### 422 Unprocessable Entity Error

The gateway rejected the batch (`Incorrecto`).

- `success` (boolean, required) — True when the gateway answered `Correcto`.
- `tipoRespuesta` (enum, required) — Gateway verdict for the whole batch.
  - Allowed values: `Correcto`, `Parcialmente correcto`, `Incorrecto`
- `altaCount` (integer, required) — Number of invoice registrations (alta) in the batch.
- `anulacionCount` (integer, required) — Number of cancellations (anulación) in the batch.
- `rawResponse` (string, required) — Raw gateway response.
- `httpStatus` (integer, required) — HTTP status of the gateway call (0 when no call was needed).
- `identificativo` (string, optional) — Gateway identifier of the filing.
- `numeroRegistro` (string, optional) — Registration number assigned by the gateway.
- `errorCode` (string, optional) — Gateway error code when the batch was rejected.
- `errorMessage` (string, optional) — Gateway error text when the batch was rejected.

### 429 Too Many Requests Error

Body `error: 'QUOTA_EXCEEDED'`: the organisation's API quota is used up, the batch was not filed. With `Retry-After`: too many requests for this key, try again after that time.

- `any`

### 500 Internal Server Error

Server error before the gateway was reached. The body carries `code` and `errorId`.

- `any`

### 501 Not Implemented Error

No LROE submission handler is wired into this deployment.

- `any`

### 503 Service Unavailable Error

Body `error: 'ESCROW_UNAVAILABLE'`: the deployment has no escrow key, not retryable. Body `code: 'SERVICE_UNAVAILABLE'` with `Retry-After`: the database is temporarily unavailable.

- `any`

## Types

### RequestValidationErrorErrorItems

- `code` (string, required) — Rule that failed, e.g. `too_big`, `invalid_type`, `invalid_value`.
- `path` (list of RequestValidationErrorErrorItemsPathItems, required) — Path of the field in the request body, e.g. `["invoice", "seller", "name"]`.
- `message` (string, required)
- `maximum` (double, optional)
- `minimum` (double, optional)
- `inclusive` (boolean, optional)
- `origin` (string, optional)
- `expected` (string, optional)
- `values` (list of any, optional)
- `keys` (list of string, optional)
- `format` (string, optional)

### RequestValidationErrorErrorItemsPathItems

- string
- double

## Examples

### Example 1

**Request**

```json
{
  "year": 1,
  "month": 1
}
```

**Response**

```json
{
  "success": true,
  "tipoRespuesta": "Correcto",
  "altaCount": 1,
  "anulacionCount": 1,
  "rawResponse": "string",
  "httpStatus": 1,
  "identificativo": "string",
  "numeroRegistro": "string",
  "errorCode": "string",
  "errorMessage": "string"
}
```

**SDK Code**

```python
import requests

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

payload = {
    "year": 1,
    "month": 1
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://service.invoice-api.xhub.io/api/v1/lroe/submit';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"year":1,"month":1}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

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

	payload := strings.NewReader("{\n  \"year\": 1,\n  \"month\": 1\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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/lroe/submit")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"year\": 1,\n  \"month\": 1\n}"

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.post("https://service.invoice-api.xhub.io/api/v1/lroe/submit")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"year\": 1,\n  \"month\": 1\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://service.invoice-api.xhub.io/api/v1/lroe/submit', [
  'body' => '{
  "year": 1,
  "month": 1
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://service.invoice-api.xhub.io/api/v1/lroe/submit");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"year\": 1,\n  \"month\": 1\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "year": 1,
  "month": 1
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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

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

### Example 2

**Request**

```json
{
  "year": 1,
  "month": 1
}
```

**Response**

```json
{
  "success": true,
  "tipoRespuesta": "Correcto",
  "altaCount": 1,
  "anulacionCount": 1,
  "rawResponse": "string",
  "httpStatus": 1,
  "identificativo": "string",
  "numeroRegistro": "string",
  "errorCode": "string",
  "errorMessage": "string"
}
```

**SDK Code**

```python
import requests

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

payload = {
    "year": 1,
    "month": 1
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://service.invoice-api.xhub.io/api/v1/lroe/submit';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"year":1,"month":1}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

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

	payload := strings.NewReader("{\n  \"year\": 1,\n  \"month\": 1\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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/lroe/submit")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"year\": 1,\n  \"month\": 1\n}"

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.post("https://service.invoice-api.xhub.io/api/v1/lroe/submit")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"year\": 1,\n  \"month\": 1\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://service.invoice-api.xhub.io/api/v1/lroe/submit', [
  'body' => '{
  "year": 1,
  "month": 1
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://service.invoice-api.xhub.io/api/v1/lroe/submit");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"year\": 1,\n  \"month\": 1\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "year": 1,
  "month": 1
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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

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