Skip to content

JSON Array Deduplicate API

Overview

Removes duplicate values from a root JSON array while preserving the first occurrence and original order.

Endpoint

POST https://api.apidatatools.com/json-array-deduplicate-api

Authentication and input modes

Include x-api-key: YOUR_API_KEY. Supports body (default), url, and file through x-source-type. Accepted extensions are .txt, .json, and .log.

Headers

Header Required Default Description
x-key-path No Empty JSON Pointer evaluated against each array item; items with equal selected values are duplicates.

curl example

curl -X POST 'https://api.apidatatools.com/json-array-deduplicate-api' \\
  -H 'x-api-key: YOUR_API_KEY' \\
  -H 'x-key-path: /id' \\
  --data-raw '[{"id":1,"name":"first"},{"id":1,"name":"duplicate"},{"id":2}]'

URL and file modes

Send {"url":"https://example.com/input.json"} with x-source-type: url, or {"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"} with x-source-type: file. Include x-key-path on the submission when deduplicating by a field.

curl --request POST --url https://api.apidatatools.com/json-array-deduplicate-api \
  --header 'x-api-key: YOUR_API_KEY' --header 'x-source-type: url' \
  --header 'x-key-path: /id' --header 'Content-Type: application/json' \
  --data '{"url":"https://example.com/input.json"}'
curl --request POST --url https://api.apidatatools.com/json-array-deduplicate-api \
  --header 'x-api-key: YOUR_API_KEY' --header 'x-source-type: file' \
  --header 'x-key-path: /id' --header 'Content-Type: application/json' \
  --data '{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}'

Success and async process

Body mode returns HTTP 200 with request_id, status, file, and preview. Async submission returns HTTP 202 with job_id, status_url, and request_id. Poll GET /jobs/JOB_ID with the same API key. Queued/processing states include retry_after; success includes result.file and result.preview; failure includes an error object.

Error handling

HTTP status Error codes
400 INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY, EXPECTED_ARRAY, INVALID_JSON_POINTER, JSON_POINTER_NOT_FOUND, INVALID_ARRAY_INDEX, INVALID_JSON, JSON_TOO_DEEP
401 UNAUTHORIZED
404 USER_NOT_FOUND, UNKNOWN_FUNCTION
413 PAYLOAD_TOO_LARGE
429 QUOTA_EXCEEDED, RATE_LIMITED
500 PLAN_NOT_FOUND, AUTH_ERROR, INTERNAL_ERROR

Async submission can report URL/file validation errors, FILE_TOO_LARGE, CONFIG_ERROR, or PLAN_CONFIG_ERROR. Status errors include INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, and DDB_ERROR; processing failures include DOWNLOAD_FAILED, UPLOAD_FAILED, and tool errors.

Notes

Honor retry_after. Plan limits govern input size and temporary output retention.