Layers

GET /v1/projects/:projectId/leased-accounts/requests/:requestId

Poll a lease request until it transitions to assigned, partial, or rejected.

View as Markdown
GET/v1/projects/:projectId/leased-accounts/requests/:requestId
Phase 1stable
Auth
Bearer
Scope
leased:write

Read the current state of a lease request. Poll this while ops works through the queue. Cadence: once an hour is plenty — typical turnaround is under 48 hours in business days.

If you'd rather not poll, subscribe to the lease_request.assigned webhook event — the emit fires once ops fulfills the request.

Path
  • projectId
    stringrequired
    Project the request was submitted against.
  • requestId
    stringrequired
    Id returned by request-lease.

Example request

curl https://api.layers.com/v1/projects/prj_01HX9Y7K8M2P4RSTUV56789AB/leased-accounts/requests/lreq_01HXZR7K8M2P4RSTUV56789AB \
  -H "Authorization: Bearer lp_live_01HX9Y6K7EJ4T2_4QZpN..."
const req = await layers.leasedAccounts.getRequest({
  projectId: "prj_01HX9Y7K8M2P4RSTUV56789AB",
  requestId: "lreq_01HXZR7K8M2P4RSTUV56789AB",
});

if (req.status === "assigned" || req.status === "partial") {
  const accounts = await layers.leasedAccounts.list({ projectId: req.projectId });
  // accounts.items now includes the assigned leased accounts
}
req = layers.leased_accounts.get_request(
    project_id="prj_01HX9Y7K8M2P4RSTUV56789AB",
    request_id="lreq_01HXZR7K8M2P4RSTUV56789AB",
)
if req["status"] in ("assigned", "partial"):
    accounts = layers.leased_accounts.list(project_id=req["projectId"])

Response

200Still queued
{
  "requestId": "lreq_01HXZR7K8M2P4RSTUV56789AB",
  "projectId": "prj_01HX9Y7K8M2P4RSTUV56789AB",
  "status": "requested",
  "submittedAt": "2026-04-18T19:24:11Z",
  "assignedAt": null,
  "assignedSocialAccountIds": [],
  "note": null
}
200Partially fulfilled — fewer accounts than requested
{
  "requestId": "lreq_01HXZR7K8M2P4RSTUV56789AB",
  "projectId": "prj_01HX9Y7K8M2P4RSTUV56789AB",
  "status": "partial",
  "submittedAt": "2026-04-18T19:24:11Z",
  "assignedAt": "2026-04-20T16:12:02Z",
  "assignedSocialAccountIds": [
    "sa_01HXZS8N3C5R6STUV7WXYZ9AB",
    "sa_01HXZS8N3C5R6STUV7WXYZ9AC",
    "sa_01HXZS8N3C5R6STUV7WXYZ9AD"
  ],
  "note": "Assigned 3 of 5 requested — the coffee/US pool is running thin. Will top up next week; open a follow-up request if you need the other 2 sooner."
}

Status values

statusTerminal?Meaning
requestednoIn the queue; not yet being worked.
assignedyesAll requested accounts delivered. See assignedSocialAccountIds.
partialyesSome accounts delivered. note explains why not all.
rejectedyesRequest can't be fulfilled (e.g. niche not supported). note explains why.

Planned additions: in_review, provisioning, failed. Existing partners don't need to change anything — the current four stay valid.

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing or invalid key.
403FORBIDDEN_SCOPEKey lacks leased:write.
404NOT_FOUNDRequest not in your organization.

See also

On this page