Use the API
Errors
One error shape for every endpoint. Branch on the code, show the message.
Every error has the same shape and an HTTP status that matches its type:
JSON
{
"error": {
"type": "invalid_request",
"code": "validation_failed",
"message": "The operations.0.width field must be between 1 and 20000.",
"param": "operations.0.width",
"request_id": "1234"
}
}
Branch on code; show message to people. A validation error also lists every field under errors. A storage change whose check failed carries the permissions_policy its new settings need. Every response carries a Request-Id header: the request's id, or ref_… for a call refused before it became a request, which is not kept as one. Quote it to support.
| Status | Type | Codes |
|---|---|---|
| 401 | authentication |
missing_api_key, invalid_api_key |
| 402 | payment_required |
insufficient_credits, paid_account_required, credit_limit_reached |
| 403 | permission |
account_suspended, scope_missing, live_key_required, not_enabled_for_account, key_outside_prefixes, storage_read_not_allowed, storage_write_not_allowed |
| 404 | not_found |
request_not_found, file_not_found, upload_not_found, storage_not_found, not_found |
| 409 | conflict |
request_finished, idempotency_key_reused, idempotency_key_in_use, upload_in_use, upload_incomplete, file_not_managed, storage_limit_reached |
| 410 | not_found |
file_gone, file_deleted, upload_consumed, upload_gone |
| 422 | invalid_request |
validation_failed, url_invalid, url_blocked, url_unresolvable, font_not_found, storage_role_refused; from verifying or changing a storage connection also destination_rejected, source_unreachable |
| 429 | rate_limited |
rate_limited (wait for Retry-After), concurrency_limited (wait for one of your requests to finish), test_mode_daily_limit |
| 500 | server_error |
server_error: retry; write to support@watermark.ws if it persists |
A request that fails while processing
A request that was accepted but could not be processed ends with status failed and an error on the request (and its webhook), not an HTTP error:
| Code | Meaning |
|---|---|
url_blocked, url_invalid, url_unresolvable |
The source or a watermark image points somewhere the API will not fetch. |
source_unreachable |
The source could not be downloaded (not found, timed out, refused). |
source_too_large |
The source is larger than your tier allows. |
unsupported_media |
The file is not a format the endpoint accepts. |
encrypted_document |
The document is password-protected. |
file_too_large |
The file, or what the operations would make of it, is past a file limit: a picture over 1,000 megapixels or 65,535 pixels a side, one that needs more memory than the API has for one file, a video over 16,384 pixels a side, a Word file that unpacks past 4 GB. Not retryable. |
too_many_tiles |
A tiled watermark's spacing would draw more copies than the limit: 10,000 on a picture or a page, 500 on a video. |
processing_timed_out |
Processing took longer than the API allows a single step: 2 minutes to read a file, about 14 minutes for each other step (an hour for long videos). |
format_mismatch |
A Word file was asked for as a PDF, or a PDF as a Word file. |
destination_rejected |
An output could not be written: your role was denied, or the presigned URL refused or expired. error.output names it. |
storage_role_refused |
The API could not assume your storage connection's role. |
request_lost |
The request stopped responding and was ended. |
processing_failed |
The file could not be processed. With error.retryable true, processing stopped for a reason that was not the file's (a worker ran out of memory or was stopped), and sending the request again usually works. |
error.retryable says whether sending the same request again may succeed. Failed requests are not charged.