Skip to main content
GET
/
api
/
v1
/
enterprise
/
eudr
/
batches
/
{batchId}
Python
import agribackup
from agribackup.rest import ApiException

# Initialize Client
configuration = agribackup.Configuration(host="https://live.agribackup.com/api/v1")
configuration.api_key['ApiKeyAuth'] = 'sk_live_YOUR_API_KEY'

with agribackup.ApiClient(configuration) as api_client:
    try:
        api_instance = agribackup.EnterpriseBatchesApi(api_client)
        response = api_instance.get_batch_by_id()
        print(response)
    except ApiException as e:
        print("Exception when calling API: %s\n" % e)
import { AgriBackupClient } from '@agribackup/sdk';

// Initialize Client
const client = new AgriBackupClient({
apiKey: 'sk_live_YOUR_API_KEY',
baseUrl: 'https://live.agribackup.com/api/v1'
});

async function execute() {
try {
const response = await client.batches.getBatchById();
console.log(response);
} catch (error) {
console.error(error);
}
}
import com.agribackup.client.*;
import com.agribackup.client.api.*;
import com.agribackup.client.model.*;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://live.agribackup.com/api/v1");
defaultClient.setApiKey("sk_live_YOUR_API_KEY");

EnterpriseBatchesApi apiInstance = new EnterpriseBatchesApi(defaultClient);
try {
Object result = apiInstance.getBatchById();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling API: " + e.getResponseBody());
}
}
}
using System;
using System.Threading.Tasks;
using AgriBackup.SDK.Api;
using AgriBackup.SDK.Client;
using AgriBackup.SDK.Model;

class Program {
static async Task Main() {
Configuration config = new Configuration();
config.BasePath = "https://live.agribackup.com/api/v1";
config.AddApiKey("ApiKeyAuth", "sk_live_YOUR_API_KEY");

var apiInstance = new EnterpriseBatchesApi(config);
try {
var result = await apiInstance.GetBatchByIdAsync();
Console.WriteLine(result);
} catch (ApiException e) {
Console.WriteLine("Exception when calling API: " + e.Message);
}
}
}
curl --request GET \
--url https://live.agribackup.com/api/v1/enterprise/eudr/batches/{batchId} \
--header 'X-API-Key: <api-key>'
const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};

fetch('https://live.agribackup.com/api/v1/enterprise/eudr/batches/{batchId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://live.agribackup.com/api/v1/enterprise/eudr/batches/{batchId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://live.agribackup.com/api/v1/enterprise/eudr/batches/{batchId}"

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

req.Header.Add("X-API-Key", "<api-key>")

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

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

fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://live.agribackup.com/api/v1/enterprise/eudr/batches/{batchId}")

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

request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "batchId": "uuid-1234",
  "batchCode": "COFFEE-KEN-20260612-ABCDEF",
  "consolidatedRiskState": "COMPLIANT",
  "status": "CREATED",
  "shipmentIds": [
    "<string>"
  ],
  "polygonIds": [
    "<string>"
  ]
}
{
"code": "VALIDATION_FAILED",
"message": "Invalid polygon coordinates",
"details": [
{
"code": "INVALID_COORDINATE_CLOSURE",
"field": "features[0].properties.area",
"issue": "Area must be specified in hectares and cannot be negative"
}
]
}
{
"code": "VALIDATION_FAILED",
"message": "Invalid polygon coordinates",
"details": [
{
"code": "INVALID_COORDINATE_CLOSURE",
"field": "features[0].properties.area",
"issue": "Area must be specified in hectares and cannot be negative"
}
]
}
Returns the full detail record for a single EUDR batch, including its consolidated Copernicus risk state, lifecycle status, all linked polygon IDs, and any shipment reference IDs assigned via the Logistics endpoints. Use this endpoint to confirm a batch is COMPLIANT and ready for shipment linking, or to retrieve shipment associations for audit purposes.

Request Headers

HeaderRequiredDescription
X-API-KeyYour live API key, e.g. sk_live_....

Path Parameters

ParameterTypeRequiredDescription
batchIdstringThe unique batch identifier (UUID) returned when the batch was registered.

Response — 200 OK

FieldTypeDescription
batchIdstringUnique internal batch identifier (UUID).
batchCodestringHuman-readable compliance code, e.g. COFFEE-KEN-20260612-ABCDEF.
consolidatedRiskStatestringAggregate risk state: PENDING_RISK_ASSESSMENT, NONE, LOW, MEDIUM, or HIGH.
statusstringBatch lifecycle status (e.g. CREATED).
polygonIdsarray of stringsIDs of all farm polygons contributing to this batch.
shipmentIdsarray of stringsShipment reference IDs linked to this batch via the Logistics API.
{
  "batchId": "uuid-1234",
  "batchCode": "COFFEE-KEN-20260612-ABCDEF",
  "consolidatedRiskState": "LOW",
  "status": "CREATED",
  "polygonIds": ["uuid-polygon-1", "uuid-polygon-2"],
  "shipmentIds": ["SHIP-OOCL-9988"]
}

Error Responses

StatusMeaning
403Your API key does not have permission to access this batch.
404No batch found with the given batchId.

Code Examples

import agribackup
from agribackup.rest import ApiException

configuration = agribackup.Configuration(host="https://live.agribackup.com/api/v1")
configuration.api_key['ApiKeyAuth'] = 'sk_live_YOUR_API_KEY'

with agribackup.ApiClient(configuration) as api_client:
    try:
        api_instance = agribackup.EnterpriseBatchesApi(api_client)
        response = api_instance.get_batch_by_id(batch_id='uuid-1234')

        print("Batch Code:", response.batch_code)
        print("Risk State:", response.consolidated_risk_state)
        print("Polygon IDs:", response.polygon_ids)
        print("Shipment IDs:", response.shipment_ids)
    except ApiException as e:
        print("Error:", e)
import { AgriBackupClient } from '@agribackup/sdk';

const client = new AgriBackupClient({
  apiKey: 'sk_live_YOUR_API_KEY',
  baseUrl: 'https://live.agribackup.com/api/v1'
});

async function getBatch(batchId) {
  try {
    const response = await client.batches.getBatchById({ batchId });
    console.log('Batch Code:', response.batchCode);
    console.log('Risk State:', response.consolidatedRiskState);
    console.log('Polygon IDs:', response.polygonIds);
    console.log('Shipment IDs:', response.shipmentIds);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

getBatch('uuid-1234');
curl https://live.agribackup.com/api/v1/enterprise/eudr/batches/uuid-1234 \
  -H "X-API-Key: sk_live_YOUR_API_KEY"

Authorizations

X-API-Key
string
header
required

Enterprise API Key provided via the AgriBackup developer console.

Path Parameters

batchId
string
required

Response

Batch details retrieved successfully

Detailed view of a single EUDR batch

batchId
string
required

Internal database ID of the batch

Example:

"uuid-1234"

batchCode
string
required

Unique compliance code for this batch

Example:

"COFFEE-KEN-20260612-ABCDEF"

consolidatedRiskState
enum<string>
required

Consolidated deterministic risk state

Available options:
PENDING_RISK_ASSESSMENT,
NONE,
LOW,
MEDIUM,
HIGH
Example:

"COMPLIANT"

status
string
required

Batch lifecycle status

Example:

"CREATED"

shipmentIds
string[]
required

Linked shipment reference IDs

Linked shipment reference IDs

polygonIds
string[]
required

Polygon IDs contributing to this batch

Polygon IDs contributing to this batch