> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agribackup.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ingest GeoJSON Polygons Async | AgriBackup

> Submit up to 5,000 GeoJSON farm-boundary polygons for satellite deforestation screening. Returns 202 Accepted with a jobId for async tracking.

Submit a batch of farm boundary polygons as GeoJSON Features for EUDR deforestation screening. Because satellite analysis and Hedera DLT anchoring run asynchronously, this endpoint returns `202 Accepted` immediately along with a `jobId`. Poll `GET /api/v1/enterprise/eudr/jobs/{jobId}` or listen for the `polygon.verified` webhook to confirm that verification has completed before referencing the polygon IDs in a batch.

## Request Headers

| Header                  | Required | Description                                                                                                        |
| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
| `X-API-Key`             | ✅        | Your live API key, e.g. `sk_live_...`. Generate one in the AgriBackup dashboard.                                   |
| `Idempotency-Key`       | ✅        | A UUID v4 string. Replaying the same key within 24 hours returns the original response without re-queuing the job. |
| `X-Sub-Organization-ID` | ☐        | Optional subsidiary identifier to scope polygon data to a specific business unit.                                  |

## Request Body

Send a JSON object with a single `features` array. Each element is a GeoJSON `Feature` with a `Polygon` geometry and a `properties` object describing the plot.

```json theme={null}
{
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [36.8, -1.2],
            [36.9, -1.2],
            [36.9, -1.3],
            [36.8, -1.3],
            [36.8, -1.2]
          ]
        ]
      },
      "properties": {
        "farmer_name": "Global Coffee Farmer #1",
        "farmer_id": "FARM-KE-001",
        "plot_name": "Nyeri Hill Farm Block B",
        "area": 2.5,
        "unit": "HECTARES",
        "commodity": "Coffee"
      }
    }
  ]
}
```

The `features` array accepts **0–5,000 items** per request. Exceeding 5,000 items returns `413 Payload Too Large`.

## Response — 202 Accepted

| Field                  | Type              | Description                                                                    |
| ---------------------- | ----------------- | ------------------------------------------------------------------------------ |
| `jobId`                | string            | Use this ID to poll job status via `GET /api/v1/enterprise/eudr/jobs/{jobId}`. |
| `status`               | string            | Always `PENDING` on acceptance.                                                |
| `estimatedDurationSec` | integer           | Estimated seconds until the verification pipeline completes.                   |
| `createdAt`            | string (ISO-8601) | Timestamp when the job was accepted.                                           |

The response also includes a `Location` header pointing to the job status endpoint.

```json theme={null}
{
  "jobId": "job_998877",
  "status": "PENDING",
  "estimatedDurationSec": 3,
  "createdAt": "2026-06-15T12:00:00Z"
}
```

## Async Completion — `polygon.verified` Webhook

When verification finishes, AgriBackup fires a `polygon.verified` event to your registered webhook URL. The payload is signed with `X-AgriBackup-Signature` (HMAC-SHA256). Polygons that pass screening receive `eudrStatus: COMPLIANT` and can immediately be referenced in batch registrations.

## Code Examples

<CodeGroup>
  ```python Python theme={null}
  import agribackup
  from agribackup.rest import ApiException
  import uuid

  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)

          request = agribackup.PolygonIngestionRequest(
              features=[
                  {
                      "type": "Feature",
                      "geometry": {
                          "type": "Polygon",
                          "coordinates": [
                              [[36.8, -1.2], [36.9, -1.2],
                               [36.9, -1.3], [36.8, -1.3], [36.8, -1.2]]
                          ]
                      },
                      "properties": {
                          "farmer_id": "FARM-KE-001",
                          "commodity": "Coffee",
                          "area": 2.5,
                          "unit": "HECTARES"
                      }
                  }
              ]
          )

          response = api_instance.ingest_polygons(
              idempotency_key=str(uuid.uuid4()),
              polygon_ingestion_request=request
          )
          print("Job accepted:", response.job_id)
      except ApiException as e:
          print("Error:", e)
  ```

  ```javascript Node.js theme={null}
  import { AgriBackupClient } from '@agribackup/sdk';
  import { v4 as uuidv4 } from 'uuid';

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

  async function ingestPolygons() {
    try {
      const response = await client.polygons.ingestPolygons({
        idempotencyKey: uuidv4(),
        features: [
          {
            type: 'Feature',
            geometry: {
              type: 'Polygon',
              coordinates: [
                [[36.8, -1.2], [36.9, -1.2],
                 [36.9, -1.3], [36.8, -1.3], [36.8, -1.2]]
              ]
            },
            properties: {
              farmerId: 'FARM-KE-001',
              commodity: 'Coffee',
              area: 2.5,
              unit: 'HECTARES'
            }
          }
        ]
      });
      console.log('Job accepted:', response.jobId);
    } catch (error) {
      console.error('Error:', error.message);
    }
  }
  ```

  ```bash cURL theme={null}
  curl -X POST https://live.agribackup.com/api/v1/enterprise/eudr/polygons \
    -H "X-API-Key: sk_live_YOUR_API_KEY" \
    -H "Idempotency-Key: $(uuidgen)" \
    -H "Content-Type: application/json" \
    -d '{
      "features": [
        {
          "type": "Feature",
          "geometry": {
            "type": "Polygon",
            "coordinates": [
              [[36.8,-1.2],[36.9,-1.2],[36.9,-1.3],[36.8,-1.3],[36.8,-1.2]]
            ]
          },
          "properties": {
            "farmer_id": "FARM-KE-001",
            "commodity": "Coffee",
            "area": 2.5,
            "unit": "HECTARES"
          }
        }
      ]
    }'
  ```
</CodeGroup>


## OpenAPI

````yaml post /api/v1/enterprise/eudr/polygons
openapi: 3.0.1
info:
  title: AgriBackup Enterprise EUDR API
  description: >-
    # Introduction


    AgriBackup is the cryptographic compliance engine for EU-bound commodity
    imports. Built on Deterministic Logic, Immutable Evidence, and
    High-Throughput Ingestion, our API provides Tier-1 enterprise routing for EU
    Deforestation Regulation (EUDR).


    ## The Integration Vector

    To integrate this Digital Trust Layer into your ERP, you must execute the
    following sequence:

    1. **Authentication:** Generate your `X-API-Key` from the client dashboard.

    2. **Telemetry:** Register your webhook URLs via `POST /webhooks`.

    3. **Ingestion:** Push your GeoJSON polygons via `POST /polygons`.

    4. **Logistics:** Lock the batch to a shipment via `POST /shipments/link`.


    ## Asynchronous Architecture

    Because satellite deforestation screening and Hedera DLT anchoring take
    time, ingestion endpoints return a `202 Accepted`. You must listen for the
    corresponding Webhook to confirm cryptographic execution.


    ## Base URLs

    * **Production:** `https://live.agribackup.com`

    * **Sandbox:** `https://sandbox.agribackup.com`
  contact:
    name: AgriBackup Architecture Team
    url: https://agribackup.com
    email: contact@agribackup.com
  license:
    name: Proprietary
    url: https://agribackup.com/terms
  version: v1.0
servers:
  - url: https://live.agribackup.com
    description: Production (Mainnet)
  - url: https://sandbox.agribackup.com
    description: Sandbox (Testnet)
security: []
tags:
  - name: Enterprise Risk Management
  - name: Enterprise Clearance Webhooks
    description: Asynchronous status receivers for TRACES NT
  - name: Enterprise Jobs
    description: Query status and metrics of asynchronous compliance jobs
  - name: Enterprise Suppliers
  - name: Enterprise Diagnostics
    description: Monitor API health, consensus ledger, and satellite systems availability
  - name: Enterprise Suppliers
    description: Map internal ERP vendor IDs to EU Operator UUIDs
  - name: Enterprise Webhooks
    description: Register endpoints for asynchronous compliance events
  - name: Enterprise Archival
    description: Endpoints for bulk compliance archiving and auditor extensibility
  - name: Enterprise Logistics
    description: Smart contract linking of batches to logistics shipments
  - name: Enterprise Declarations
    description: DDS generation with legal land tenure proofs
  - name: Enterprise Batches
  - name: Enterprise API Keys
  - name: Enterprise Diagnostics
  - name: Enterprise Logistics
  - name: Enterprise Jobs
  - name: Enterprise Evidence
    description: Cryptographic evidence ledger anchored on Hedera Hashgraph
  - name: Enterprise Declarations
  - name: Enterprise Credentials
  - name: Enterprise Evidence
  - name: Enterprise Risk Management
    description: Pre-assessment of country risk and satellite deforestation probabilities
  - name: Enterprise Batches
    description: Programmatic batch ingestion and management
  - name: Enterprise Polygons
  - name: Introduction
  - name: Enterprise Polygons
    description: Programmatic polygon ingestion and verification
  - name: Enterprise Archival
  - name: Enterprise Credentials
    description: Programmatic ingestion of vault-secured enterprise secrets
  - name: Enterprise API Keys
    description: Endpoints for managing B2B API Keys (Requires standard JWT login)
  - name: Enterprise Webhooks
paths:
  /api/v1/enterprise/eudr/polygons:
    post:
      tags:
        - Enterprise Polygons
      summary: Ingest GeoJSON Polygons (Async)
      description: >-
        Programmatically ingest farm/production unit polygons. Returns 202
        instantly. The bulk ingestion engine runs deforestation checks and fires
        'polygon.verified' webhook upon completion.
      operationId: ingestPolygons
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - $ref: '#/components/parameters/IdempotencyKey'
          name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/SubOrganizationId'
          name: X-Sub-Organization-ID
          in: header
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PolygonIngestionRequest'
        required: true
      responses:
        '202':
          description: Polygon ingestion accepted and queued for verification
          headers:
            X-RateLimit-Remaining:
              description: >-
                The number of requests remaining in the current rate limit
                window.
              schema:
                type: integer
                format: int32
            X-RateLimit-Reset:
              description: >-
                The time at which the current rate limit window resets in UTC
                epoch seconds.
              schema:
                type: integer
                format: int32
            X-RateLimit-Limit:
              description: >-
                The maximum number of requests you're permitted to make per
                hour.
              schema:
                type: integer
                format: int32
            X-Trace-Id:
              description: Unique request trace identifier
              style: simple
              schema:
                type: string
            Location:
              description: >-
                The relative URI path to track the lifecycle phase and final
                cryptographic consensus receipts for this job.
              style: simple
              schema:
                type: string
                example: /api/v1/enterprise/eudr/jobs/job_998877
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobAcceptedResponse'
        '400':
          description: Bad Request
          headers:
            X-RateLimit-Limit:
              description: >-
                The maximum number of requests you're permitted to make per
                hour.
              schema:
                type: integer
                format: int32
            X-RateLimit-Remaining:
              description: >-
                The number of requests remaining in the current rate limit
                window.
              schema:
                type: integer
                format: int32
            X-RateLimit-Reset:
              description: >-
                The time at which the current rate limit window resets in UTC
                epoch seconds.
              schema:
                type: integer
                format: int32
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Unauthorized
          headers:
            X-RateLimit-Limit:
              description: >-
                The maximum number of requests you're permitted to make per
                hour.
              schema:
                type: integer
                format: int32
            X-RateLimit-Remaining:
              description: >-
                The number of requests remaining in the current rate limit
                window.
              schema:
                type: integer
                format: int32
            X-RateLimit-Reset:
              description: >-
                The time at which the current rate limit window resets in UTC
                epoch seconds.
              schema:
                type: integer
                format: int32
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: Forbidden
          headers:
            X-RateLimit-Limit:
              description: >-
                The maximum number of requests you're permitted to make per
                hour.
              schema:
                type: integer
                format: int32
            X-RateLimit-Remaining:
              description: >-
                The number of requests remaining in the current rate limit
                window.
              schema:
                type: integer
                format: int32
            X-RateLimit-Reset:
              description: >-
                The time at which the current rate limit window resets in UTC
                epoch seconds.
              schema:
                type: integer
                format: int32
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '413':
          description: 'Payload Too Large: Maximum allowed array size is 5000.'
          headers:
            X-RateLimit-Limit:
              description: >-
                The maximum number of requests you're permitted to make per
                hour.
              schema:
                type: integer
                format: int32
            X-RateLimit-Remaining:
              description: >-
                The number of requests remaining in the current rate limit
                window.
              schema:
                type: integer
                format: int32
            X-RateLimit-Reset:
              description: >-
                The time at which the current rate limit window resets in UTC
                epoch seconds.
              schema:
                type: integer
                format: int32
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '423':
          description: >-
            Locked: Execution thread is currently processing the resource. Wait
            and retry.
          headers:
            X-RateLimit-Limit:
              description: >-
                The maximum number of requests you're permitted to make per
                hour.
              schema:
                type: integer
                format: int32
            X-RateLimit-Remaining:
              description: >-
                The number of requests remaining in the current rate limit
                window.
              schema:
                type: integer
                format: int32
            X-RateLimit-Reset:
              description: >-
                The time at which the current rate limit window resets in UTC
                epoch seconds.
              schema:
                type: integer
                format: int32
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: Too Many Requests
          headers:
            X-RateLimit-Limit:
              description: >-
                The maximum number of requests you're permitted to make per
                hour.
              schema:
                type: integer
                format: int32
            X-RateLimit-Remaining:
              description: >-
                The number of requests remaining in the current rate limit
                window.
              schema:
                type: integer
                format: int32
            X-RateLimit-Reset:
              description: >-
                The time at which the current rate limit window resets in UTC
                epoch seconds.
              schema:
                type: integer
                format: int32
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: Python
          source: >-
            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.ingest_polygons()
                    print(response)
                except ApiException as e:
                    print("Exception when calling API: %s\n" % e)
        - lang: Node.js
          source: |-
            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.ingestPolygons();
                console.log(response);
              } catch (error) {
                console.error(error);
              }
            }
        - lang: Java
          source: |-
            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.ingestPolygons();
                        System.out.println(result);
                    } catch (ApiException e) {
                        System.err.println("Exception when calling API: " + e.getResponseBody());
                    }
                }
            }
        - lang: C#
          source: |-
            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.IngestPolygonsAsync();
                        Console.WriteLine(result);
                    } catch (ApiException e) {
                        Console.WriteLine("Exception when calling API: " + e.Message);
                    }
                }
            }
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      description: >-
        Unique idempotency key (UUID) to prevent duplicate operations. Safely
        stored in Redis with a strict 24-hour TTL to prevent memory bloat during
        saturation attacks.
      required: true
      schema:
        type: string
        format: uuid
    SubOrganizationId:
      name: X-Sub-Organization-ID
      in: header
      description: >-
        Optional identifier to partition compliance data (polygons, batches,
        declarations) for a specific subsidiary or regional business unit within
        the conglomerate.
      required: false
      schema:
        type: string
  schemas:
    PolygonIngestionRequest:
      required:
        - features
      type: object
      properties:
        features:
          maxItems: 5000
          minItems: 0
          type: array
          description: Array of GeoJSON Features representing farm boundaries
          items:
            $ref: '#/components/schemas/GeoJsonFeature'
      description: Payload to ingest GeoJSON polygons conforming to RFC 7946
      example:
        features:
          - type: Feature
            geometry:
              type: Polygon
              coordinates:
                - - - 36.8
                    - -1.2
                  - - 36.9
                    - -1.2
                  - - 36.9
                    - -1.3
                  - - 36.8
                    - -1.3
                  - - 36.8
                    - -1.2
            properties:
              farmer_name: 'Global Coffee Farmer #1'
              farmer_id: TEST_FARMER_100
              plot_name: Nyeri Hill Farm Block B
              area: 2.5
              unit: HECTARES
              commodity: Coffee
    JobAcceptedResponse:
      required:
        - createdAt
        - estimatedDurationSec
        - jobId
        - status
      type: object
      properties:
        jobId:
          type: string
          description: The unique asynchronous tracking job ID
          example: job_998877
        status:
          type: string
          description: Current execution status invariant
          example: PENDING
          enum:
            - PENDING
        estimatedDurationSec:
          type: integer
          description: >-
            Estimated duration in seconds before consensus or processing lock
            release
          format: int32
          example: 3
        createdAt:
          type: string
          description: Timestamp when the job was accepted
          format: date-time
          example: '2026-06-15T12:00:00Z'
      description: Response payload for asynchronously accepted jobs
    ApiError:
      required:
        - code
        - details
        - message
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: VALIDATION_FAILED
        message:
          type: string
          description: Human-readable error message
          example: Invalid polygon coordinates
        details:
          type: array
          description: Detailed list of validation errors, if applicable
          items:
            $ref: '#/components/schemas/ApiErrorDetail'
      description: Standard error format for all Enterprise API failures
    GeoJsonFeature:
      required:
        - geometry
        - properties
        - type
      type: object
      properties:
        type:
          type: string
          description: GeoJSON Type (must be Feature)
          example: Feature
        geometry:
          $ref: '#/components/schemas/GeoJsonGeometry'
        properties:
          $ref: '#/components/schemas/FeatureProperties'
      description: Formal GeoJSON Feature conforming to RFC 7946
    ApiErrorDetail:
      required:
        - code
        - field
        - issue
      type: object
      properties:
        code:
          type: string
          description: Programmatic error code for automated branch logic
          example: INVALID_COORDINATE_CLOSURE
        field:
          type: string
          description: The field or property that caused the error
          example: features[0].properties.area
        issue:
          type: string
          description: A description of the issue with the field
          example: Area must be specified in hectares and cannot be negative
      description: Detailed error information for a specific field
    GeoJsonGeometry:
      required:
        - coordinates
        - type
      type: object
      properties:
        type:
          type: string
          description: Geometry type (Polygon or MultiPolygon)
          example: Polygon
          enum:
            - Polygon
            - MultiPolygon
        coordinates:
          $ref: '#/components/schemas/GeoJsonCoordinates'
      description: Formal GeoJSON Geometry conforming to RFC 7946
    FeatureProperties:
      required:
        - area
        - commodity
        - farmer_id
        - farmer_name
        - plot_name
        - unit
      type: object
      properties:
        farmer_name:
          type: string
          description: Full name of the farmer/producer
          example: 'Global Coffee Farmer #1'
        farmer_id:
          type: string
          description: Unique identification reference code for the farmer
          example: TEST_FARMER_100
        plot_name:
          type: string
          description: Descriptive name of the farm plot
          example: Nyeri Hill Farm Block B
        area:
          type: number
          description: Area of the plot
          format: double
          example: 2.5
        unit:
          type: string
          description: >-
            Unit of measurement. Must be explicitly set to HECTARES to guarantee
            deterministic satellite calibration.
          example: HECTARES
          default: HECTARES
          enum:
            - HECTARES
        commodity:
          type: string
          description: Crop commodity produced on the plot
          example: Coffee
      description: Metadata properties associated with the spatial feature
    GeoJsonCoordinates:
      type: array
      description: >-
        Polygon: number[][][], MultiPolygon: number[][][][] conforming to RFC
        7946
      items:
        type: array
        items:
          maxItems: 2
          minItems: 2
          type: array
          items:
            type: number
            format: double
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enterprise API Key provided via the AgriBackup developer console.
      name: X-API-Key
      in: header

````