Skip to main content
PATCH
/
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.update_batch()
        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.updateBatch();
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.updateBatch();
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.UpdateBatchAsync();
Console.WriteLine(result);
} catch (ApiException e) {
Console.WriteLine("Exception when calling API: " + e.Message);
}
}
}
curl --request PATCH \
--url https://live.agribackup.com/api/v1/enterprise/eudr/batches/{batchId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"quantity": 5000,
"commodityDescription": "Roasted Cocoa Beans",
"hsCode": "180100",
"harvestDate": "2023-11-15"
}
'
const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
quantity: 5000,
commodityDescription: 'Roasted Cocoa Beans',
hsCode: '180100',
harvestDate: '2023-11-15'
})
};

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 => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'quantity' => 5000,
'commodityDescription' => 'Roasted Cocoa Beans',
'hsCode' => '180100',
'harvestDate' => '2023-11-15'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)

func main() {

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

payload := strings.NewReader("{\n \"quantity\": 5000,\n \"commodityDescription\": \"Roasted Cocoa Beans\",\n \"hsCode\": \"180100\",\n \"harvestDate\": \"2023-11-15\"\n}")

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

req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

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::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quantity\": 5000,\n \"commodityDescription\": \"Roasted Cocoa Beans\",\n \"hsCode\": \"180100\",\n \"harvestDate\": \"2023-11-15\"\n}"

response = http.request(request)
puts response.read_body
{}
Partially updates the mutable fields of a registered EUDR batch. You can correct the commodity description, quantity, HS code, or harvest date at any point before the batch is cryptographically locked to a shipment on the Hedera ledger or submitted to TRACES NT. Once locked, the batch record is immutable and this endpoint will return 403 Forbidden. Only the fields you include in the request body are updated; omitted fields retain their existing values.

Request Headers

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

Path Parameters

ParameterTypeRequiredDescription
batchIdstringThe unique batch identifier (UUID) to be updated.

Request Body

All fields are optional. Include only the fields you wish to change.
FieldTypeDescription
quantitynumberUpdated total commodity weight or volume.
commodityDescriptionstringUpdated human-readable commodity description, e.g. Roasted Cocoa Beans.
hsCodestringUpdated 6-digit HS code, e.g. 180100.
harvestDatestring (date)Updated harvest date in YYYY-MM-DD format, e.g. 2023-11-15.
{
  "quantity": 5000,
  "commodityDescription": "Roasted Cocoa Beans",
  "hsCode": "180100",
  "harvestDate": "2023-11-15"
}

Response — 200 OK

Returns an empty object {} on successful update.

Error Responses

StatusMeaning
401Missing or invalid X-API-Key.
403The batch is cryptographically linked to a shipment or TRACES NT and cannot be modified.
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)

        update = agribackup.BatchUpdateRequest(
            quantity=5000,
            commodity_description='Roasted Cocoa Beans',
            hs_code='180100',
            harvest_date='2023-11-15'
        )

        api_instance.update_batch(
            batch_id='uuid-1234',
            batch_update_request=update
        )
        print("Batch updated successfully.")
    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 updateBatch(batchId) {
  try {
    await client.batches.updateBatch({
      batchId,
      quantity: 5000,
      commodityDescription: 'Roasted Cocoa Beans',
      hsCode: '180100',
      harvestDate: '2023-11-15'
    });
    console.log('Batch updated successfully.');
  } catch (error) {
    console.error('Error:', error.message);
  }
}

updateBatch('uuid-1234');
curl -X PATCH https://live.agribackup.com/api/v1/enterprise/eudr/batches/uuid-1234 \
  -H "X-API-Key: sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "quantity": 5000,
    "commodityDescription": "Roasted Cocoa Beans",
    "hsCode": "180100",
    "harvestDate": "2023-11-15"
  }'

Authorizations

X-API-Key
string
header
required

Enterprise API Key provided via the AgriBackup developer console.

Path Parameters

batchId
string
required

Body

application/json

Payload for updating a consolidated batch pre-consensus

quantity
number

Updated total weight/volume

Example:

5000

commodityDescription
string

Updated commodity description

Example:

"Roasted Cocoa Beans"

hsCode
string

Updated HS6 Code

Example:

"180100"

harvestDate
string<date>

Updated harvest date

Example:

"2023-11-15"

Response

200 - */*

OK

The response is of type object.