Polygons
Delete Polygon | AgriBackup EUDR API
Permanently delete a farm boundary polygon by ID. Deletion is blocked if the polygon is linked to an active batch or shipment on the Hedera ledger.
DELETE
/
api
/
v1
/
enterprise
/
eudr
/
polygons
/
{polygonId}
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.EnterprisePolygonsApi(api_client)
response = api_instance.delete_polygon()
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.polygons.deletePolygon();
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");
EnterprisePolygonsApi apiInstance = new EnterprisePolygonsApi(defaultClient);
try {
Object result = apiInstance.deletePolygon();
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 EnterprisePolygonsApi(config);
try {
var result = await apiInstance.DeletePolygonAsync();
Console.WriteLine(result);
} catch (ApiException e) {
Console.WriteLine("Exception when calling API: " + e.Message);
}
}
}curl --request DELETE \
--url https://live.agribackup.com/api/v1/enterprise/eudr/polygons/{polygonId} \
--header 'X-API-Key: <api-key>'const options = {method: 'DELETE', headers: {'X-API-Key': '<api-key>'}};
fetch('https://live.agribackup.com/api/v1/enterprise/eudr/polygons/{polygonId}', 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/polygons/{polygonId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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/polygons/{polygonId}"
req, _ := http.NewRequest("DELETE", 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/polygons/{polygonId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{}Permanently removes a farm boundary polygon from your organisation’s compliance record. This operation is only permitted when the polygon has not been cryptographically linked to a batch or shipment on the Hedera ledger. If the polygon is already referenced by an active batch, you must delete or update that batch first before attempting to delete the polygon.
Request Headers
| Header | Required | Description |
|---|---|---|
X-API-Key | ✅ | Your live API key, e.g. sk_live_.... |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
polygonId | string | ✅ | The unique polygon identifier to be deleted. |
Response — 200 OK
Returns an empty object{} on successful deletion.
Error Responses
| Status | Meaning |
|---|---|
401 | Missing or invalid X-API-Key. |
403 | Forbidden — the polygon is cryptographically linked to a batch or shipment and cannot be deleted. |
404 | No polygon found with the given polygonId. |
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.EnterprisePolygonsApi(api_client)
api_instance.delete_polygon(polygon_id='uuid-1234')
print("Polygon deleted 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 deletePolygon(polygonId) {
try {
await client.polygons.deletePolygon({ polygonId });
console.log('Polygon deleted successfully.');
} catch (error) {
console.error('Error:', error.message);
}
}
deletePolygon('uuid-1234');
curl -X DELETE https://live.agribackup.com/api/v1/enterprise/eudr/polygons/uuid-1234 \
-H "X-API-Key: sk_live_YOUR_API_KEY"
Get Polygon Compliance Status | AgriBackup
Previous
Register Consolidated EUDR Batch Async | AgriBackup
Next
⌘I
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.EnterprisePolygonsApi(api_client)
response = api_instance.delete_polygon()
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.polygons.deletePolygon();
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");
EnterprisePolygonsApi apiInstance = new EnterprisePolygonsApi(defaultClient);
try {
Object result = apiInstance.deletePolygon();
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 EnterprisePolygonsApi(config);
try {
var result = await apiInstance.DeletePolygonAsync();
Console.WriteLine(result);
} catch (ApiException e) {
Console.WriteLine("Exception when calling API: " + e.Message);
}
}
}curl --request DELETE \
--url https://live.agribackup.com/api/v1/enterprise/eudr/polygons/{polygonId} \
--header 'X-API-Key: <api-key>'const options = {method: 'DELETE', headers: {'X-API-Key': '<api-key>'}};
fetch('https://live.agribackup.com/api/v1/enterprise/eudr/polygons/{polygonId}', 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/polygons/{polygonId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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/polygons/{polygonId}"
req, _ := http.NewRequest("DELETE", 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/polygons/{polygonId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{}