{"openapi":"3.1.0","info":{"title":"Sourevo API","version":"1.0.0","description":"EUDR due diligence from your ERP: products with CN code, suppliers and invitations, plots, batches, due diligence statements submitted to TRACES and the reference number back by webhook.\n\nAuthentication: \"Authorization: Bearer svk_...\". At most 120 requests per minute per key.\n\nErrors: { \"error\": { \"code\", \"message\", \"details\" } }; business rules answer 422 with details.reason.\n\nPOST accepts an Idempotency-Key header (24 h): a retry returns the stored answer with \"Idempotent-Replayed: true\".\n\nIncluded in Pro, Forwarder and Enterprise; during the trial the API works in simulated mode (SIM references).","contact":{"name":"Sourevo","url":"https://sourevo.com"}},"servers":[{"url":"https://sourevo.com/api/v1"}],"security":[{"bearer":[]}],"tags":[{"name":"Account"},{"name":"Operators"},{"name":"Suppliers"},{"name":"Plots"},{"name":"Products"},{"name":"Batches"},{"name":"DDS"},{"name":"Webhooks"}],"paths":{"/me":{"get":{"summary":"Organization, plan, mode and key (use it to test the connection)","tags":["Account"],"operationId":"get_me","parameters":[{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operators":{"get":{"summary":"Companies that submit to TRACES","tags":["Operators"],"operationId":"get_operators","parameters":[{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Operator"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor to get the next page; null on the last one."}},"required":["data","nextCursor"]}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/suppliers":{"get":{"summary":"List suppliers","tags":["Suppliers"],"operationId":"get_suppliers","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page."},{"name":"externalRef","in":"query","required":false,"schema":{"type":"string"},"description":"Only the one with this ERP id."},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Supplier"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor to get the next page; null on the last one."}},"required":["data","nextCursor"]}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a supplier","tags":["Suppliers"],"operationId":"post_suppliers","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Supplier"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden, forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/suppliers/{id}":{"get":{"summary":"Get a supplier","tags":["Suppliers"],"operationId":"get_suppliers_id","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Supplier"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Update a supplier you own (partial)","tags":["Suppliers"],"operationId":"patch_suppliers_id","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierPatch"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Supplier"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden, forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/suppliers/{id}/status":{"get":{"summary":"Trust level, plots summary, account and invitation","tags":["Suppliers"],"operationId":"get_suppliers_id_status","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierStatus"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/suppliers/{id}/invitations":{"post":{"summary":"Invite the supplier to its portal (emailed when it has an address)","tags":["Suppliers"],"operationId":"post_suppliers_id_invitations","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden, forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/suppliers/{id}/plots":{"get":{"summary":"Plots of a supplier your organization can use","tags":["Plots"],"operationId":"get_suppliers_id_plots","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page."},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Plot"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor to get the next page; null on the last one."}},"required":["data","nextCursor"]}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Upload plots as your proposal to the supplier","description":"Same rules as the upload form: 4 ha rule, valid WGS84 geometry, vertex limit. The supplier confirms, corrects or rejects each plot (webhook plot.proposal_answered).","tags":["Plots"],"operationId":"post_suppliers_id_plots","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlotInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Plot"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor to get the next page; null on the last one."}},"required":["data","nextCursor"]}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden, forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/plots/{id}":{"get":{"summary":"Get a plot","tags":["Plots"],"operationId":"get_plots_id","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Plot"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/plots/{id}/verify":{"post":{"summary":"Verify (approve) the plot for your organization","tags":["Plots"],"operationId":"post_plots_id_verify","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Plot"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden, forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/plots/{id}/correction-request":{"post":{"summary":"Ask the supplier to correct the plot ({ reason })","tags":["Plots"],"operationId":"post_plots_id_correction_request","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Plot"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden, forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/plots/{id}/satellite-checks":{"post":{"summary":"Run a satellite deforestation check now","tags":["Plots"],"operationId":"post_plots_id_satellite_checks","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SatelliteCheck"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"service_unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/plots/{id}/satellite-checks/latest":{"get":{"summary":"Latest satellite check by your organization","tags":["Plots"],"operationId":"get_plots_id_satellite_checks_latest","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SatelliteCheck"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/products":{"get":{"summary":"List products","tags":["Products"],"operationId":"get_products","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page."},{"name":"externalRef","in":"query","required":false,"schema":{"type":"string"},"description":"Only the one with this ERP id."},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor to get the next page; null on the last one."}},"required":["data","nextCursor"]}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a product (CN code; scientific name for wood)","tags":["Products"],"operationId":"post_products","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/products/{id}":{"get":{"summary":"Get a product","tags":["Products"],"operationId":"get_products_id","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/batches":{"get":{"summary":"List batches","tags":["Batches"],"operationId":"get_batches","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page."},{"name":"externalRef","in":"query","required":false,"schema":{"type":"string"},"description":"Only the one with this ERP id."},{"name":"productId","in":"query","required":false,"schema":{"type":"string"},"description":"Only batches of this product."},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Batch"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor to get the next page; null on the last one."}},"required":["data","nextCursor"]}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a batch (a goods receipt) and link its plots","tags":["Batches"],"operationId":"post_batches","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Batch"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/batches/{id}":{"get":{"summary":"Get a batch","tags":["Batches"],"operationId":"get_batches_id","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Batch"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/batches/{id}/plots":{"post":{"summary":"Link plots ({ plotIds })","tags":["Batches"],"operationId":"post_batches_id_plots","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Batch"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/batches/{id}/plots/{plotId}":{"delete":{"summary":"Unlink a plot","tags":["Batches"],"operationId":"delete_batches_id_plots_plotId","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"plotId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Batch"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dds":{"get":{"summary":"List due diligence statements","tags":["DDS"],"operationId":"get_dds","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page."},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Comma separated: DRAFT, SUBMITTED, AVAILABLE, REJECTED, CANCELLED, WITHDRAWN, ARCHIVED."},{"name":"operatorId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this operator."},{"name":"batchId","in":"query","required":false,"schema":{"type":"string"},"description":"Only this batch."},{"name":"internalReferenceNumber","in":"query","required":false,"schema":{"type":"string"},"description":"Exact internal reference."},{"name":"updatedSince","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Changed at or after this instant (polling)."},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Dds"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor to get the next page; null on the last one."}},"required":["data","nextCursor"]}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a draft from a batch","tags":["DDS"],"operationId":"post_dds","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DdsInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dds"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden, forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dds/{id}":{"get":{"summary":"Get a DDS (status, reference and verification numbers)","tags":["DDS"],"operationId":"get_dds_id","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dds"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Change a draft","tags":["DDS"],"operationId":"patch_dds_id","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DdsPatch"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dds"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Delete a draft","tags":["DDS"],"operationId":"delete_dds_id","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dds/{id}/risk-assessment":{"post":{"summary":"Record the risk assessment of a draft","tags":["DDS"],"operationId":"post_dds_id_risk_assessment","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RiskAssessment"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dds"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dds/{id}/check":{"get":{"summary":"Pre-submission check: blocking issues and warnings","tags":["DDS"],"operationId":"get_dds_id_check","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"includePayload","in":"query","required":false,"schema":{"type":"string","enum":["true"]},"description":"Also return the payload that would be sent to TRACES."},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckReport"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dds/{id}/submit":{"post":{"summary":"Submit to TRACES ({ acknowledgedWarnings })","description":"Every warning key from /check must be in acknowledgedWarnings; acknowledging is recorded as acting under your responsibility. In the trial, the simulated TRACES answers with a SIM reference.","tags":["DDS"],"operationId":"post_dds_id_submit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dds"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden, forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict, idempotency_in_progress","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"unprocessable, idempotency_key_reused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"upstream_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dds/{id}/amend":{"post":{"summary":"Amend a submitted DDS (activityType, countries, comment, geoLocationConfidential)","tags":["DDS"],"operationId":"post_dds_id_amend","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dds"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"upstream_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dds/{id}/retract":{"post":{"summary":"Retract a submitted DDS ({ reason })","tags":["DDS"],"operationId":"post_dds_id_retract","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dds"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"upstream_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dds/{id}/refresh":{"post":{"summary":"Ask TRACES for the current status now","tags":["DDS"],"operationId":"post_dds_id_refresh","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dds"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"upstream_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks":{"get":{"summary":"List webhook endpoints","tags":["Webhooks"],"operationId":"get_webhooks","parameters":[{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEndpoint"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor to get the next page; null on the last one."}},"required":["data","nextCursor"]}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Register a webhook endpoint ({ url, events?, description? })","tags":["Webhooks"],"operationId":"post_webhooks","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointCreated"}}}},"400":{"description":"invalid_webhook_url, validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}":{"delete":{"summary":"Delete a webhook endpoint","tags":["Webhooks"],"operationId":"delete_webhooks_id","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/test":{"post":{"summary":"Send a signed ping now","tags":["Webhooks"],"operationId":"post_webhooks_id_test","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"delivered":{"type":"boolean"},"statusCode":{"type":["number","null"]},"error":{"type":["string","null"]},"deliveryId":{"type":"string"}},"required":["delivered","statusCode","error","deliveryId"]}}}},"400":{"description":"validation_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"payload_too_large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/deliveries":{"get":{"summary":"Delivery log of an endpoint","tags":["Webhooks"],"operationId":"get_webhooks_id_deliveries","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"nextCursor of the previous page."},{"$ref":"#/components/parameters/Client"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"nextCursor":{"type":["string","null"],"description":"Pass as cursor to get the next page; null on the last one."}},"required":["data","nextCursor"]}}}},"401":{"description":"missing_api_key, invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"plan_not_allowed, key_owner_forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{"dds.submitted":{"post":{"summary":"dds.submitted","parameters":[{"name":"X-Sourevo-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Signature","in":"header","required":true,"schema":{"type":"string","description":"t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<body>\")>"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx acknowledges the delivery; anything else is retried with backoff."}}}},"dds.status_changed":{"post":{"summary":"dds.status_changed","parameters":[{"name":"X-Sourevo-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Signature","in":"header","required":true,"schema":{"type":"string","description":"t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<body>\")>"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx acknowledges the delivery; anything else is retried with backoff."}}}},"plot.proposal_answered":{"post":{"summary":"plot.proposal_answered","parameters":[{"name":"X-Sourevo-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Signature","in":"header","required":true,"schema":{"type":"string","description":"t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<body>\")>"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx acknowledges the delivery; anything else is retried with backoff."}}}},"plot.satellite_flagged":{"post":{"summary":"plot.satellite_flagged","parameters":[{"name":"X-Sourevo-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Signature","in":"header","required":true,"schema":{"type":"string","description":"t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<body>\")>"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx acknowledges the delivery; anything else is retried with backoff."}}}},"supplier.claimed":{"post":{"summary":"supplier.claimed","parameters":[{"name":"X-Sourevo-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Signature","in":"header","required":true,"schema":{"type":"string","description":"t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<body>\")>"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx acknowledges the delivery; anything else is retried with backoff."}}}},"plan.quota_80":{"post":{"summary":"plan.quota_80","parameters":[{"name":"X-Sourevo-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Signature","in":"header","required":true,"schema":{"type":"string","description":"t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<body>\")>"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx acknowledges the delivery; anything else is retried with backoff."}}}},"plan.quota_100":{"post":{"summary":"plan.quota_100","parameters":[{"name":"X-Sourevo-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Signature","in":"header","required":true,"schema":{"type":"string","description":"t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<body>\")>"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx acknowledges the delivery; anything else is retried with backoff."}}}},"ping":{"post":{"summary":"ping","parameters":[{"name":"X-Sourevo-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Delivery","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-Sourevo-Signature","in":"header","required":true,"schema":{"type":"string","description":"t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<body>\")>"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx acknowledges the delivery; anything else is retried with backoff."}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"API key svk_... created in API and integrations."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Makes a POST safe to retry for 24 hours."},"Client":{"name":"X-Sourevo-Client","in":"header","required":false,"schema":{"type":"string","maxLength":60},"description":"Your program, e.g. \"Odoo 18\". Shown in the first-use email."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["missing_api_key","invalid_api_key","plan_not_allowed","key_owner_forbidden","forbidden","not_found","conflict","idempotency_in_progress","payload_too_large","validation_error","idempotency_key_reused","unprocessable","rate_limited","internal_error","upstream_error","service_unavailable","invalid_webhook_url"]},"message":{"type":"string","description":"English, for logs. Program against code and details.reason."},"details":{"type":"object","additionalProperties":true,"properties":{"reason":{"type":"string","enum":["acknowledgement_required","area_required_for_point","batch_frozen","batch_has_live_dds","business_rule","coordinates_incomplete","external_ref_taken","geojson_empty","geojson_feature_without_geometry","geojson_invalid_geometry","geojson_invalid_json","geojson_not_wgs84","geojson_polygon_invalid","geojson_polygon_not_closed","geojson_polygon_too_few_vertices","geojson_too_many_vertices","geojson_unsupported_geometry","geometry_required","internal_reference_taken","invalid_address","invalid_area","invalid_cn_code","invalid_country","invalid_cursor","invalid_date","invalid_email","invalid_external_ref","invalid_idempotency_key","invalid_input","invalid_json","invalid_legal_name","invalid_limit","invalid_name","invalid_phone","invalid_quantity","invalid_status","invalid_tax_id","invalid_verification","key_already_revoked","latitude_out_of_range","longitude_out_of_range","no_satellite_check","not_a_draft","operator_without_credentials","pack_plan","plan_expired","plan_limit_reached","plot_not_found","plot_rejected","plot_without_geometry","polygon_required_over_4_ha","pre_submission_blocked","quantity_required","reason_required","retract_reason_required","role_not_allowed","scientific_name_required","storage_unavailable","submission_in_progress","supplier_already_claimed","supplier_not_owned","tax_id_declared_by_supplier","too_many_webhooks","traces_fault","traces_permission_denied","traces_rejected","trial_expired","trial_simulated_only"]}}}},"required":["code","message"]}},"required":["error"]},"TaxId":{"type":"object","properties":{"value":{"type":"string"},"country":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2."},"source":{"type":"string","enum":["SUPPLIER","IMPORTER"]},"validation":{"type":"string","enum":["NOT_ATTEMPTED","VALIDATED","NOT_VALIDATABLE","FAILED"]}},"required":["value","country","source","validation"]},"Supplier":{"type":"object","properties":{"id":{"type":"string"},"externalRef":{"type":["string","null"],"description":"Your ERP id (only on suppliers your organization owns)."},"name":{"type":"string"},"legalName":{"type":["string","null"]},"country":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2."},"postalAddress":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"taxId":{"oneOf":[{"$ref":"#/components/schemas/TaxId"},{"type":"null"}]},"trustLevel":{"type":"string","enum":["LEVEL_0_ANONYMOUS","LEVEL_1_EMAIL_VERIFIED","LEVEL_2_TAX_DECLARED","LEVEL_3_TAX_VALIDATED"]},"trustSignal":{"type":"string","enum":["RED","AMBER","GREEN"]},"owned":{"type":"boolean","description":"False when another organization shares this supplier with you: read-only."},"claimed":{"type":"boolean","description":"The supplier has its own Sourevo account."},"createdAt":{"type":"string","format":"date-time"}},"required":["id","externalRef","name","legalName","country","postalAddress","email","phone","taxId","trustLevel","trustSignal","owned","claimed","createdAt"]},"SupplierInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"country":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2."},"legalName":{"type":"string","maxLength":300},"postalAddress":{"type":"string","maxLength":500},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"taxId":{"type":"string","description":"VAT, CNPJ, NIT... checked against the format of the country."},"externalRef":{"type":"string","maxLength":100,"description":"Your ERP id. Sending an existing one returns that supplier (200, duplicate: true)."}},"required":["name","country"]},"SupplierPatch":{"type":"object","properties":{"name":{"type":"string"},"country":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2."},"legalName":{"type":["string","null"]},"postalAddress":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"taxId":{"type":["string","null"]},"externalRef":{"type":["string","null"]}},"required":[]},"SupplierStatus":{"type":"object","properties":{"supplierId":{"type":"string"},"owned":{"type":"boolean"},"trustLevel":{"type":"string","enum":["LEVEL_0_ANONYMOUS","LEVEL_1_EMAIL_VERIFIED","LEVEL_2_TAX_DECLARED","LEVEL_3_TAX_VALIDATED"]},"trustSignal":{"type":"string","enum":["RED","AMBER","GREEN"]},"claimed":{"type":"boolean"},"claimedAt":{"type":["string","null"],"format":"date-time"},"taxId":{"oneOf":[{"$ref":"#/components/schemas/TaxId"},{"type":"null"}]},"invitation":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["PENDING","ACCEPTED","REVOKED","EXPIRED"]},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"acceptedAt":{"type":["string","null"],"format":"date-time"},"active":{"type":"boolean"}},"required":["status","createdAt","expiresAt","acceptedAt","active"]},{"type":"null"}]},"plots":{"type":"object","properties":{"total":{"type":"number"},"verified":{"type":"number"},"declared":{"type":"number"},"correctionRequested":{"type":"number"},"proposalsPending":{"type":"number"},"proposalsRejected":{"type":"number"},"satelliteFlagged":{"type":"number"},"satelliteUnchecked":{"type":"number"}},"required":["total","verified","declared","correctionRequested","proposalsPending","proposalsRejected","satelliteFlagged","satelliteUnchecked"]}},"required":["supplierId","owned","trustLevel","trustSignal","claimed","claimedAt","taxId","invitation","plots"]},"Invitation":{"type":"object","properties":{"invitationId":{"type":"string"},"url":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time"},"emailedTo":{"type":["string","null"]},"emailStatus":{"type":"string","enum":["sent","failed","skipped"]}},"required":["invitationId","url","expiresAt","emailedTo","emailStatus"]},"Geometry":{"type":"object","description":"GeoJSON geometry in WGS84: Point, Polygon or MultiPolygon.","properties":{"type":{"type":"string","enum":["Point","Polygon","MultiPolygon"]},"coordinates":{"type":"array"}},"required":["type","coordinates"]},"SatelliteCheck":{"type":"object","properties":{"id":{"type":"string"},"verdict":{"type":"string","enum":["NO_LOSS_DETECTED","LOSS_DETECTED","NO_FOREST_2020","INCONCLUSIVE","FAILED"],"description":"LOSS_DETECTED means \"needs human review\", never \"deforested\"."},"reason":{"type":["string","null"]},"checkedAt":{"type":"string","format":"date-time"},"current":{"type":["boolean","null"],"description":"False when the plot geometry changed after the check."},"approximated":{"type":"boolean"},"bufferRadiusM":{"type":["number","null"]},"analysedAreaHa":{"type":["number","null"]},"forest2020Ha":{"type":["number","null"]},"lossAfterCutoffHa":{"type":["number","null"]},"lossByYear":{"type":["object","null"],"additionalProperties":{"type":"number"}},"alertsCount":{"type":["number","null"]},"provider":{"type":"string"},"errorDetail":{"type":["string","null"]}},"required":["id","verdict","reason","checkedAt","current","approximated","bufferRadiusM","analysedAreaHa","forest2020Ha","lossAfterCutoffHa","lossByYear","alertsCount","provider","errorDetail"]},"Plot":{"type":"object","properties":{"id":{"type":"string"},"supplierId":{"type":["string","null"]},"name":{"type":"string"},"country":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2."},"areaHa":{"type":["number","null"]},"geometry":{"oneOf":[{"$ref":"#/components/schemas/Geometry"},{"type":"null"}]},"source":{"type":"string","enum":["SUPPLIER","IMPORTER"]},"proposal":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["PENDING","CONFIRMED","CORRECTED","REJECTED"]},"uploadedAt":{"type":"string","format":"date-time"},"confirmedAt":{"type":["string","null"],"format":"date-time"},"rejectedAt":{"type":["string","null"],"format":"date-time"},"rejectionReason":{"type":["string","null"]}},"required":["status","uploadedAt","confirmedAt","rejectedAt","rejectionReason"]},{"type":"null"}]},"verification":{"type":"object","properties":{"status":{"type":"string","enum":["DECLARED","VERIFIED","CORRECTION_REQUESTED"]},"comment":{"type":["string","null"]},"at":{"type":["string","null"],"format":"date-time"}},"required":["status","comment","at"]},"satellite":{"oneOf":[{"$ref":"#/components/schemas/SatelliteCheck"},{"type":"null"}]},"batchCount":{"type":"number"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","supplierId","name","country","areaHa","geometry","source","proposal","verification","satellite","batchCount","createdAt"]},"PlotInput":{"type":"object","description":"Either geojson (Geometry, Feature or FeatureCollection; feature properties name/ProducerCountry/Area are read) or latitude + longitude + areaHa. Every plot is a PENDING proposal to the supplier.","properties":{"name":{"type":"string"},"country":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2."},"areaHa":{"type":"number","exclusiveMinimum":0,"description":"Required for a point; a plot over 4 ha must be a polygon."},"latitude":{"type":"number","minimum":-90,"maximum":90},"longitude":{"type":"number","minimum":-180,"maximum":180},"geojson":{"oneOf":[{"type":"object"},{"type":"string"}]}}},"Product":{"type":"object","properties":{"id":{"type":"string"},"externalRef":{"type":["string","null"]},"description":{"type":"string"},"cnCode":{"type":"string"},"hsHeading":{"type":"string","pattern":"^[0-9]{4}$"},"scientificName":{"type":["string","null"]},"commonName":{"type":["string","null"]},"annex":{"type":"object","properties":{"inScope":{"type":"boolean"},"sector":{"type":["string","null"]},"appliesFrom":{"type":["string","null"]}},"required":["inScope","sector","appliesFrom"]}},"required":["id","externalRef","description","cnCode","hsHeading","scientificName","commonName","annex"]},"ProductInput":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":150},"cnCode":{"type":"string","pattern":"^[0-9 .]{4,12}$","description":"CN code, 4 to 8 digits (\"0901 11 00\" accepted)."},"hsHeading":{"type":"string","pattern":"^[0-9]{4}$","description":"Only if you do not send cnCode."},"scientificName":{"type":"string","description":"Required for wood (chapter 44 and the other wood headings)."},"commonName":{"type":"string"},"externalRef":{"type":"string","maxLength":100}},"required":["description"]},"Batch":{"type":"object","properties":{"id":{"type":"string"},"externalRef":{"type":["string","null"],"description":"Your goods receipt, e.g. WH/IN/00012."},"productId":{"type":"string"},"netWeightKg":{"type":["number","null"]},"volumeM3":{"type":["number","null"]},"supplementaryUnit":{"type":["string","null"]},"supplementaryUnitQuantity":{"type":["number","null"]},"plotIds":{"type":"array","items":{"type":"string"}},"ddsIds":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","externalRef","productId","netWeightKg","volumeM3","supplementaryUnit","supplementaryUnitQuantity","plotIds","ddsIds","createdAt"]},"BatchInput":{"type":"object","properties":{"productId":{"type":"string"},"netWeightKg":{"oneOf":[{"type":"number"},{"type":"string"}],"description":"> 0, at most 3 decimals. netWeightKg or volumeM3 is required."},"volumeM3":{"oneOf":[{"type":"number"},{"type":"string"}]},"supplementaryUnit":{"type":"string","maxLength":10},"supplementaryUnitQuantity":{"type":"number"},"externalRef":{"type":"string","maxLength":100},"plotIds":{"type":"array","items":{"type":"string"}}},"required":["productId"]},"Operator":{"type":"object","properties":{"id":{"type":"string"},"legalName":{"type":"string"},"country":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2."},"address":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"eoriNumber":{"type":["string","null"]},"hasCredentials":{"type":"boolean"}},"required":["id","legalName","country","address","email","phone","eoriNumber","hasCredentials"]},"Dds":{"type":"object","properties":{"id":{"type":"string"},"internalReferenceNumber":{"type":"string"},"status":{"type":"string","enum":["DRAFT","SUBMITTED","AVAILABLE","REJECTED","CANCELLED","WITHDRAWN","ARCHIVED"]},"simulated":{"type":"boolean","description":"Submitted to the simulated TRACES (SIM reference): never reached the Commission."},"operatorId":{"type":"string"},"batchId":{"type":["string","null"]},"activityType":{"type":"string","enum":["IMPORT","EXPORT","DOMESTIC","TRADE"]},"operatorRole":{"type":"string","enum":["OPERATOR","TRADER","AUTHORISED_REPRESENTATIVE"]},"representedRole":{"type":["string","null"],"enum":["OPERATOR","TRADER",null]},"countryOfActivity":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2."},"borderCrossCountry":{"type":["string","null"]},"comment":{"type":["string","null"]},"geoLocationConfidential":{"type":"boolean"},"riskAssessment":{"oneOf":[{"type":"object","properties":{"conclusion":{"type":"string","enum":["NEGLIGIBLE","NON_NEGLIGIBLE_MITIGATED"]},"notes":{"type":["string","null"]}},"required":["conclusion","notes"]},{"type":"null"}]},"associatedStatements":{"type":"array","items":{"type":"object","properties":{"referenceNumber":{"type":"string"},"verificationNumber":{"type":"string"}},"required":["referenceNumber","verificationNumber"]}},"tracesUuid":{"type":["string","null"]},"referenceNumber":{"type":["string","null"],"description":"The TRACES reference number for customs."},"verificationNumber":{"type":["string","null"]},"submitting":{"type":"boolean"},"lastSyncedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","internalReferenceNumber","status","simulated","operatorId","batchId","activityType","operatorRole","representedRole","countryOfActivity","borderCrossCountry","comment","geoLocationConfidential","riskAssessment","associatedStatements","tracesUuid","referenceNumber","verificationNumber","submitting","lastSyncedAt","createdAt","updatedAt"]},"RiskAssessment":{"type":"object","properties":{"conclusion":{"type":"string","enum":["NEGLIGIBLE","NON_NEGLIGIBLE_MITIGATED"]},"notes":{"type":"string","minLength":1,"maxLength":5000}},"required":["conclusion","notes"]},"DdsInput":{"type":"object","properties":{"batchId":{"type":"string"},"operatorId":{"type":"string","description":"From GET /operators."},"internalReferenceNumber":{"type":"string","maxLength":200,"description":"Unique per operator; TRACES accepts 50 characters."},"activityType":{"type":"string","enum":["IMPORT","EXPORT","DOMESTIC","TRADE"]},"operatorRole":{"type":"string","enum":["OPERATOR","TRADER","AUTHORISED_REPRESENTATIVE"]},"representedRole":{"type":"string","enum":["OPERATOR","TRADER"],"description":"Required iff operatorRole is AUTHORISED_REPRESENTATIVE."},"countryOfActivity":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2."},"borderCrossCountry":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2."},"comment":{"type":"string","maxLength":2000},"geoLocationConfidential":{"type":"boolean"},"associatedStatements":{"type":"array","items":{"type":"object","properties":{"referenceNumber":{"type":"string"},"verificationNumber":{"type":"string"}},"required":["referenceNumber","verificationNumber"]}},"riskAssessment":{"$ref":"#/components/schemas/RiskAssessment"}},"required":["batchId","operatorId","internalReferenceNumber","activityType","operatorRole","countryOfActivity"]},"DdsPatch":{"type":"object","properties":{"internalReferenceNumber":{"type":"string"},"activityType":{"type":"string","enum":["IMPORT","EXPORT","DOMESTIC","TRADE"]},"operatorRole":{"type":"string","enum":["OPERATOR","TRADER","AUTHORISED_REPRESENTATIVE"]},"representedRole":{"type":["string","null"]},"countryOfActivity":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2."},"borderCrossCountry":{"type":["string","null"]},"comment":{"type":["string","null"]},"geoLocationConfidential":{"type":"boolean"},"associatedStatements":{"type":"array","items":{"type":"object","properties":{"referenceNumber":{"type":"string"},"verificationNumber":{"type":"string"}},"required":["referenceNumber","verificationNumber"]}}},"required":[]},"CheckIssue":{"type":"object","properties":{"key":{"type":"string","description":"Send it in acknowledgedWarnings to accept this warning."},"code":{"type":"string","description":"E.g. PLOT_NOT_VERIFIED, SUPPLIER_TRUST_BELOW_VALIDATED, NO_RISK_ASSESSMENT."},"level":{"type":"string","enum":["operator","product","batch","plot","supplier","statement"]},"entityId":{"type":"string"},"data":{"type":"object","additionalProperties":true}},"required":["key","code","level","entityId"]},"CheckReport":{"type":"object","properties":{"ready":{"type":"boolean"},"blocking":{"type":"array","items":{"$ref":"#/components/schemas/CheckIssue"}},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/CheckIssue"}},"payload":{"type":"object"}},"required":["ready","blocking","warnings"]},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["dds.submitted","dds.status_changed","plot.proposal_answered","plot.satellite_flagged","supplier.claimed","plan.quota_80","plan.quota_100"]}},"description":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","url","events","description","createdAt"]},"WebhookEndpointCreated":{"allOf":[{"$ref":"#/components/schemas/WebhookEndpoint"},{"type":"object","properties":{"secret":{"type":"string","description":"whsec_..., shown only now. Verify X-Sourevo-Signature with it."}},"required":["secret"]}]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"eventType":{"type":"string"},"occurredAt":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["PENDING","SUCCEEDED","FAILED"]},"attempts":{"type":"number"},"lastStatusCode":{"type":["number","null"]},"lastError":{"type":["string","null"]},"lastAttemptAt":{"type":["string","null"],"format":"date-time"},"nextAttemptAt":{"type":["string","null"],"format":"date-time"},"deliveredAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","eventId","eventType","occurredAt","status","attempts","lastStatusCode","lastError","lastAttemptAt","nextAttemptAt","deliveredAt","createdAt"]},"WebhookEvent":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["dds.submitted","dds.status_changed","plot.proposal_answered","plot.satellite_flagged","supplier.claimed","plan.quota_80","plan.quota_100","ping"]},"createdAt":{"type":"string","format":"date-time"},"data":{"type":"object","additionalProperties":true}},"required":["id","type","createdAt","data"]},"Me":{"type":"object","properties":{"organization":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"taxId":{"type":"string"}},"required":["id","name","taxId"]},"mode":{"type":"string","enum":["live","simulated"]},"plan":{"type":"object","additionalProperties":true},"key":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}},"required":["name","email"]}},"required":["id","name","prefix","createdAt","createdBy"]},"role":{"type":"string","enum":["OWNER","ADMIN"]}},"required":["organization","mode","plan","key","role"]},"Deleted":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean"}},"required":["id","deleted"]}}}}