Idempotency
A network error after you send POST /v1/checks leaves you not
knowing whether the check was created. Send an Idempotency-Key
header, and you can retry without risk of a second check (and a second
charge):
curl https://api.linkspect.com/v1/checks \
-H "Authorization: Bearer $LINKSPECT_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 3f6c2a0e-8d4b-4e1a-9c57-2b7d1e0f4a93" \
-d '{"url": "https://example.com/", "targets": [{"country": "PL"}]}'
- Use a fresh unique value, such as a UUID, for each check you mean to create, and reuse it only for retries of that same request.
- A retry with the same key and the same body within 24 hours returns the original response. Nothing new is created or charged.
- The same key with a different body gets
422idempotency-key-reuse. - Keys belong to your API key: another customer's key with the same value does not collide with yours.