JSON Redact API¶
Overview¶
Replaces values at selected RFC 6901 JSON Pointer paths.
Endpoint¶
POST https://api.apidatatools.com/json-redact-api
Authentication¶
Include x-api-key: YOUR_API_KEY.
Input modes¶
Supports body, url, and file. URL and file modes are asynchronous.
Headers¶
| Header | Required | Default | Description |
|---|---|---|---|
x-api-key | Yes | — | API key. |
x-source-type | No | body | Input mode. |
x-redact-paths | Yes | — | Comma-separated JSON Pointer paths. |
x-redact-value | No | [REDACTED] | Replacement string. |
Accepted file extensions¶
.txt, .json, and .log.
curl example¶
curl -X POST 'https://api.apidatatools.com/json-redact-api' \\
-H 'x-api-key: YOUR_API_KEY' \\
-H 'x-redact-paths: /password,/profile/token' \\
--data-raw '{"password":"secret","profile":{"token":"abc","name":"Ada"}}'
URL and file mode examples¶
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-redact-paths and optional x-redact-value on the submission.
curl --request POST --url https://api.apidatatools.com/json-redact-api \
--header 'x-api-key: YOUR_API_KEY' --header 'x-source-type: url' \
--header 'x-redact-paths: /password,/profile/token' \
--header 'Content-Type: application/json' --data '{"url":"https://example.com/input.json"}'
curl --request POST --url https://api.apidatatools.com/json-redact-api \
--header 'x-api-key: YOUR_API_KEY' --header 'x-source-type: file' \
--header 'x-redact-paths: /password' --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, temporary file, and preview. Async submission returns HTTP 202 with job_id, status_url, and request_id. Poll the status URL with the same API key. Queued/processing responses include retry_after; success includes result.file and result.preview; failure includes error.code, message, and details.
{"status":"accepted","job_id":"JOB_ID","status_url":"https://api.apidatatools.com/jobs/JOB_ID","request_id":"REQUEST_ID"}
Error handling¶
| HTTP status | Error codes |
|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY, MISSING_REDACT_PATHS, 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 requests may return 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; worker failures include DOWNLOAD_FAILED and UPLOAD_FAILED.
Notes¶
Escape ~ as ~0 and / as ~1 inside pointer segments. An empty pointer targets the document root. - Body mode is synchronous; URL/file modes are asynchronous. - Honor retry_after. Limits and output retention depend on your plan.