> ## 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.

# Register a New Supplier Mapping

> Bind an internal ERP vendor ID to an official EU TRACES NT Operator UUID to enable EUDR supply chain traceability for that supplier.

The EUDR requires operators to demonstrate full supply chain traceability for regulated commodities. AgriBackup's supplier registry bridges your internal ERP identifiers to the official EU TRACES NT Operator UUIDs needed for Due Diligence Statement filing. Use this endpoint to register a new mapping between your ERP's vendor ID and a supplier's TRACES NT Operator UUID. Once registered, you can reference the `vendorId` when creating batches to associate sourcing origin with a verified supply chain entity.

**`POST /api/v1/enterprise/eudr/suppliers`**

## Request Body

<ParamField body="vendorId" type="string" required>
  Your internal ERP Vendor ID that uniquely identifies this supplier within your own systems. This value must match the vendor ID you use in your ERP or procurement platform.

  **Example:** `"VEND-1002"`
</ParamField>

<ParamField body="operatorUuid" type="string" required>
  The official EU TRACES NT Operator UUID for this supplier. This UUID is assigned by the European Commission's TRACES NT platform and is required for DDS filing. Your supplier can retrieve this UUID from their TRACES NT account profile.

  **Example:** `"123e4567-e89b-12d3-a456-426614174000"`
</ParamField>

<ParamField body="companyName" type="string" required>
  The legal registered company name of the supplier.

  **Example:** `"Acme Sourcing Ltd"`
</ParamField>

<ParamField body="taxId" type="string">
  The supplier's Tax Identification Number. Providing this improves audit traceability and is recommended for suppliers in jurisdictions that require tax identification on DDS documents.

  **Example:** `"TAX-1234"`
</ParamField>

<ParamField body="countryCode" type="string">
  The ISO-3166-1 alpha-3 country code of the supplier's country of registration (e.g., `KEN` for Kenya, `BRA` for Brazil, `IDN` for Indonesia). This is used for Country Risk Matrix lookups when associating this supplier with a batch.

  **Example:** `"KEN"`
</ParamField>

<ParamField body="parentVendorId" type="string">
  The ERP Vendor ID of this supplier's parent supplier in your chain of custody hierarchy. Provide this to model multi-tier supply chains where a Tier-2 or Tier-3 supplier sources through a Tier-1 intermediary.

  **Example:** `"VEND-1001"`
</ParamField>

## Code Examples

<CodeGroup>
  ```python Python theme={null}
  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"

  payload = {
      "vendorId": "VEND-1002",
      "operatorUuid": "123e4567-e89b-12d3-a456-426614174000",
      "companyName": "Acme Sourcing Ltd",
      "taxId": "TAX-1234",
      "countryCode": "KEN",
      "parentVendorId": "VEND-1001"
  }

  with agribackup.ApiClient(configuration) as api_client:
      try:
          api_instance = agribackup.EnterpriseSuppliersApi(api_client)
          response = api_instance.register_supplier(body=payload)
          print(f"Supplier registered with ID: {response.id}")
      except ApiException as e:
          print("Exception when calling API: %s\n" % e)
  ```

  ```javascript Node.js theme={null}
  import { AgriBackupClient } from "@agribackup/sdk";

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

  async function registerSupplier() {
    try {
      const response = await client.suppliers.registerSupplier({
        vendorId: "VEND-1002",
        operatorUuid: "123e4567-e89b-12d3-a456-426614174000",
        companyName: "Acme Sourcing Ltd",
        taxId: "TAX-1234",
        countryCode: "KEN",
        parentVendorId: "VEND-1001",
      });
      console.log(`Supplier registered with ID: ${response.id}`);
    } catch (error) {
      console.error(error);
    }
  }

  registerSupplier();
  ```

  ```bash cURL theme={null}
  curl --request POST \
    --url https://live.agribackup.com/api/v1/enterprise/eudr/suppliers \
    --header "Content-Type: application/json" \
    --header "Authorization: Bearer sk_live_YOUR_API_KEY" \
    --data '{
      "vendorId": "VEND-1002",
      "operatorUuid": "123e4567-e89b-12d3-a456-426614174000",
      "companyName": "Acme Sourcing Ltd",
      "taxId": "TAX-1234",
      "countryCode": "KEN",
      "parentVendorId": "VEND-1001"
    }'
  ```
</CodeGroup>

## Response

A `200 OK` response returns the full supplier mapping record, including the internally assigned `id` that you can use to retrieve this mapping later.

```json theme={null}
{
  "id": "sup_11aabbccddee",
  "vendorId": "VEND-1002",
  "operatorUuid": "123e4567-e89b-12d3-a456-426614174000",
  "companyName": "Acme Sourcing Ltd",
  "taxId": "TAX-1234",
  "countryCode": "KEN",
  "parentVendorId": "VEND-1001"
}
```

<ResponseField name="id" type="string">
  The unique internal AgriBackup identifier assigned to this supplier mapping. Use this value as the path parameter in the [Get Supplier](/sdks/enterprise-suppliers/get-supplier-mapping) endpoint.
</ResponseField>

<ResponseField name="vendorId" type="string">
  Your internal ERP Vendor ID, as submitted.
</ResponseField>

<ResponseField name="operatorUuid" type="string">
  The EU TRACES NT Operator UUID, as submitted.
</ResponseField>

<ResponseField name="companyName" type="string">
  The supplier company name, as submitted.
</ResponseField>

<ResponseField name="taxId" type="string">
  The Tax Identification Number, as submitted. Returns `null` if not provided.
</ResponseField>

<ResponseField name="countryCode" type="string">
  The ISO-3166-1 alpha-3 country code, as submitted. Returns `null` if not provided.
</ResponseField>

<ResponseField name="parentVendorId" type="string">
  The parent supplier's ERP Vendor ID, as submitted. Returns `null` if not provided.
</ResponseField>

## Error Responses

| HTTP Status             | Error Code            | Description                                                                                                                            |
| ----------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `400 Bad Request`       | `VALIDATION_FAILED`   | A required field (`vendorId`, `operatorUuid`, or `companyName`) is missing or malformed, or `operatorUuid` is not a valid UUID format. |
| `401 Unauthorized`      | `UNAUTHORIZED`        | The `Authorization` header is absent or the bearer token is not recognised.                                                            |
| `403 Forbidden`         | `FORBIDDEN`           | Your API key does not have the required scope to register supplier mappings.                                                           |
| `409 Conflict`          | `DUPLICATE_VENDOR_ID` | A supplier mapping with this `vendorId` already exists for your organization.                                                          |
| `429 Too Many Requests` | `RATE_LIMITED`        | You have exceeded the hourly rate limit. Check `X-RateLimit-Reset` for your reset time.                                                |

```json theme={null}
{
  "code": "VALIDATION_FAILED",
  "message": "Invalid payload",
  "details": [
    {
      "code": "INVALID_UUID_FORMAT",
      "field": "operatorUuid",
      "issue": "operatorUuid must be a valid RFC 4122 UUID"
    }
  ]
}
```
