POST/api/v1/annotation-queues/{queueId}/claim-next

Atomically claim the next unlocked item in a queue

Picks the oldest unlocked + uncompleted item, locks it to the caller for lockMinutes (default 15), and returns the item + rubric_items. Stale locks (older than TTL) are auto-swept before each claim. Retries up to 3x on race; 409 CLAIM_CONFLICT if contention exhausts attempts.

Authentication

Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/api-keys.

Parameters

queueId in pathrequired
string

Request body

Example

{
  "lockMinutes": 15
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "lockMinutes": {
          "type": "integer",
          "minimum": 1,
          "maximum": 120,
          "default": 15
        }
      }
    }
  }
}

Response

All status codes

200{claimed: item, rubric, lockExpiresAt, attempt} or {claimed: null, reason: 'queue-empty'}
400(no description)
401(no description)
409CLAIM_CONFLICT after exhausting retries
429(no description)
500DB_ERROR

Code samples

cURL

curl -X POST \
  https://evalguard.ai/api/v1/annotation-queues/{queueId}/claim-next \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "lockMinutes": 15 }'

TypeScript

import { EvalGuard } from "@evalguard/sdk";

const client = new EvalGuard({ apiKey: process.env.EVALGUARD_API_KEY });

const response = await client.request({
  method: "POST",
  path: "/api/v1/annotation-queues/{queueId}/claim-next",
  body: {
    "lockMinutes": 15
  },
});
console.log(response);

Python

from evalguard import EvalGuard
import os

client = EvalGuard(api_key=os.environ["EVALGUARD_API_KEY"])

response = client.request(
    method="POST",
    path="/api/v1/annotation-queues/{queueId}/claim-next",
    body={
    "lockMinutes": 15
},
)
print(response)

Go

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/evalguard/evalguard-go"
)

func main() {
	client := evalguard.NewClient(os.Getenv("EVALGUARD_API_KEY"))
	resp, err := client.Request(context.Background(), "POST", "/api/v1/annotation-queues/{queueId}/claim-next", map[string]any{"lockMinutes": 15})
	if err != nil { panic(err) }
	fmt.Println(resp)
}

Errors

400401409429500

Other Annotations endpoints