Limai Docs
API ReferenceDeployments

Examples

Manage a model's extraction examples

List Examples

GET/api/v1/deployments/{deploymentId}/examples

Returns the files in a model's example pool. Examples are used to improve extraction accuracy through few-shot learning.

Which files come back depends on how you addressed the pool. Address the model and you get its whole pool. Address a deployment and you get the shared examples plus the ones scoped to that deployment — an isolated deployment's examples are hidden from its siblings, not from the model.

Parameters

NameTypeInRequiredDescription
deploymentIdstringpathYesThe model or deployment ID
pinnedstringqueryNoFilter by pinned status: true or false

Request

const res = await fetch(
"https://app.limai.io/api/v1/deployments/dep_abc123/examples?pinned=true",
{
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
  },
}
);
const { data, summary } = await res.json();

Response

Response200
{
  "data": [
    {
      "id": "file_001",
      "name": "sample_invoice.pdf",
      "isPinned": true,
      "description": "Standard invoice with line items",
      "isConfirmed": true,
      "scope": "SHARED",
      "scopeDeploymentId": null
    }
  ],
  "summary": {
    "total": 5,
    "pinnedCount": 2,
    "withDescriptionCount": 3
  },
  "modelId": "dep_abc123",
  "viaDeploymentId": "dpl_prod01"
}
FieldTypeDescription
data[].namestringThe file's alias when it has one, otherwise its uploaded name.
data[].scopeSHARED | PRIVATESHARED for an example in the model's pool, PRIVATE for one scoped to a single deployment.
data[].scopeDeploymentIdstring | nullThe deployment that owns a PRIVATE example; null for a SHARED one.

summary counts the whole addressed pool. The pinned filter narrows data only, so total can exceed the number of entries returned.


Update Example Description

PATCH/api/v1/deployments/{deploymentId}/examples/{fileId}/description

Update or clear the description of an example file. Descriptions help the extraction model understand what kind of document the example represents.

Parameters

NameTypeInRequiredDescription
deploymentIdstringpathYesThe model or deployment ID
fileIdstringpathYesThe example file ID
descriptionstring | nullbodyYesDescription text (max 500 chars) or null to clear

Request

const res = await fetch(
"https://app.limai.io/api/v1/deployments/dep_abc123/examples/file_001/description",
{
  method: "PATCH",
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    description: "Standard invoice with line items and tax breakdown",
  }),
}
);

Response

Response200
{
  "success": true,
  "description": "Standard invoice with line items and tax breakdown",
  "modelId": "dep_abc123",
  "viaDeploymentId": "dpl_prod01"
}

Toggle Example Pin

PATCH/api/v1/deployments/{deploymentId}/examples/{fileId}/pin

Pin or unpin an example file. Pinned examples are always included in extraction prompts.

Parameters

NameTypeInRequiredDescription
deploymentIdstringpathYesThe model or deployment ID
fileIdstringpathYesThe example file ID
pinnedbooleanbodyNoSet pin state. Omit to toggle.

Request

const res = await fetch(
"https://app.limai.io/api/v1/deployments/dep_abc123/examples/file_001/pin",
{
  method: "PATCH",
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ pinned: true }),
}
);

Response

Response200
{
  "success": true,
  "isPinned": true,
  "modelId": "dep_abc123",
  "viaDeploymentId": "dpl_prod01"
}

On this page