Adoption holds and concurrency
Blüdhaven Pets coordinates companion animal adoptions across three physical retail branches and an online public portal. An in-store counselor and an online applicant can reach for the same animal at once. The API enforces atomic reservation locks to prevent that double-booking.
How 30-minute holds work
When an applicant begins an interview or starts checkout online, your client application must request a temporary hold:
[Available Animal] ──► POST /adoptions/holds ──► [30-Minute Hold Granted]
│
▼ (Second concurrent request)
[HTTP 409 Conflict]
- State verification. The API confirms the animal stores
status: "AVAILABLE"and readstruefromhealth_record.spay_neuter_certified. - Lock creation. The API writes an
AdoptionHoldrecord and sets the animal status toRESERVED_HOLD. - Expiration TTL. The server assigns an immutable expiration timestamp exactly 1,800 seconds after creation.
- Resolution.
- If the applicant completes paperwork and pays the adoption fees, staff submit an application and the hold moves to
CONVERTED. - If 30 minutes lapse without completion, an automated background reaper marks the hold
EXPIREDand returns the animal toAVAILABLE.
- If the applicant completes paperwork and pays the adoption fees, staff submit an application and the hold moves to
Placing a reservation hold
Send a POST request to /adoptions/holds with the animal and applicant identifiers.
curl -X POST https://api.bludhavenpets.com/v1/adoptions/holds \
-H "Authorization: Bearer <STAFF_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"animal_id": "pet_krypto_210",
"applicant_id": "usr_9921bc",
"notes": "In-person consultation at the Downtown adoption floor"
}'
Successful response
201 Created
{
"id": "hld_77a28f",
"animal_id": "pet_krypto_210",
"applicant_id": "usr_9921bc",
"branch_id": "loc_harbor_04",
"status": "ACTIVE",
"created_at": "2026-11-17T07:45:00Z",
"expires_at": "2026-11-17T08:15:00Z",
"seconds_remaining": 1782
}
Handling 409 Conflict collisions
When another staff member or online applicant claims an animal first, the endpoint returns an HTTP 409 Conflict using the RFC 9457 ProblemDetails standard.
{
"type": "https://api.bludhavenpets.com/errors/adoption-hold-conflict",
"title": "Adoption Hold Conflict",
"status": 409,
"detail": "Animal pet_krypto_210 is currently reserved under active hold hld_77a28f expiring at 2026-11-17T08:15:00Z.",
"instance": "/adoptions/holds"
}
Releasing a hold early
A counselor releases the lock the moment an interview fails or the applicant walks out. Otherwise the animal sits invisible to other adopters for the rest of the half hour.
curl -X DELETE https://api.bludhavenpets.com/v1/adoptions/holds/hld_77a28f \
-H "Authorization: Bearer <STAFF_TOKEN>"
204 No Content confirms the release, and the animal returns to AVAILABLE immediately. A hold that already converted into an application returns 409, because a release can't undo a submitted application.
Recommended client recovery flow
- Parse the
detailmessage or inspect the target animal profile. - Check
expires_aton the active hold. - If the customer wants to wait, prompt them to join a notification queue that alerts them if the active hold expires without conversion.
- Offer alternative companion animals matching the same species and temperament profile.