Skip to main content

1. Pre-Assessment & Authentication

The following methods are available via the AgriBackup SDK for this integration stage.

Assess risk by polygon (Pre-Assessment)​

Runs Country Risk Matrix lookups and satellite Sentinel-2 deforestation analysis on-the-fly for a GeoJSON polygon.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const polygonRiskRequest = {
"geoJson": {}
};
const response = await client.riskManagement.assessPolygonRisk(polygonRiskRequest);
console.log(response.data);

Assess risk by coordinate (Pre-Assessment)​

Runs Country Risk Matrix lookups and satellite Sentinel-2 deforestation analysis on-the-fly for a coordinate, returning predictive risk metrics without registering a batch.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const coordinateRiskRequest = {
"latitude": -1.2921,
"longitude": 36.8219
};
const response = await client.riskManagement.assessCoordinateRisk(coordinateRiskRequest);
console.log(response.data);

Ingest TRACES NT Credentials into Vault​

Accepts the raw TRACES NT API token/password, symmetrically encrypts it via HashiCorp Vault Transit Engine, and stores the resulting ciphertext reference.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const tracesCredentialRequest = {
"tokenOrPassword": "secret_abc123",
"username": "eudr_enterprise_user"
};
const response = await client.credentials.ingestTracesCredentials(tracesCredentialRequest);
console.log(response.data);

Revoke and purge TRACES NT credentials​

Deletes the organization's TRACES NT credentials reference from the database, permanently revoking delegation. Due to our stateless transit-based encryption, clearing the ciphertext reference completely purges the secret from the system.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.credentials.deleteTracesCredentials();
console.log(response.data);

List API Keys​

Returns a list of all active API keys for the organization (without raw keys).

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.apiKeys.listApiKeys();
console.log(response.data);

Generate a new API Key​

Generates a new secure API Key with defined scopes. Returns the raw key only once.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const apiKeyCreateRequest = {
"name": "Default Sandbox Key",
"scopes": [
"[\"*\"]"
]
};
const response = await client.apiKeys.createApiKey(apiKeyCreateRequest);
console.log(response.data);

Rotate an API Key​

Deactivates the old key and generates a new raw key with the same configuration.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.apiKeys.rotateApiKey('keyId');
console.log(response.data);

Check TRACES NT credential delegation status​

Verifies if the credentials registered in HashiCorp Vault for this organization are valid by executing a connection test to the TRACES NT SOAP API.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.credentials.getTracesCredentialsStatus();
console.log(response.data);

Delete an API Key​

Permanently removes an API key.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.apiKeys.deleteApiKey('keyId');
console.log(response.data);