Attach glossaries and rulesets
Attach and detach an engine's glossaries and rulesets one at a time or as a complete set, and list the terms the engine applies.
An engine applies every glossary and ruleset attached to it. A glossary or ruleset can be attached to several engines in its organization, and changing it changes the guidance of all of them. Attaching does not copy terms or rules into the engine.
All routes use https://api.lingo.dev and API authentication. Changing attachments requires engine:edit on the engine, and every glossary or ruleset you attach must belong to the engine's organization and be readable by the caller. See permissions.
Attach or detach one set #
PUT /v2/engines/:id/glossaries/:glossaryId
X-API-Key: YOUR_API_KEYDELETE /v2/engines/:id/glossaries/:glossaryId
X-API-Key: YOUR_API_KEYRulesets use PUT and DELETE on /v2/engines/:id/rulesets/:rulesetId. None of these requests has a body, and each returns HTTP 200 with an empty body.
Both are safe to repeat. Attaching a set that is already attached, or detaching one that is not, changes nothing and still returns 200. Other attachments are unaffected.
A glossary or ruleset that does not exist, belongs to another organization, or is not readable by the caller returns AttachmentsUnreachable (422). Its kind and ids identify the rejected sets:
{
"type": "https://lingo.dev/docs/api/errors/attachments-unreachable",
"title": "Attachments out of reach",
"status": 422,
"detail": "Cannot apply these rulesets to this engine: rst_example. Each one must belong to the engine's organization and be visible to you. Leave them out of the request, or ask for access.",
"kind": "ruleset",
"ids": ["rst_example"]
}Replace the attached sets #
To set the complete list in one request, send attachments in an engine update:
PATCH /v2/engines/:id
Content-Type: application/json
X-API-Key: YOUR_API_KEY{
"attachments": {
"glossaryIds": ["gls_product_terms", "gls_legal_terms"],
"rulesetIds": ["rst_support_style"]
}
}| Field | Contract |
|---|---|
glossaryIds | Optional array of unique glossary IDs. It becomes the engine's complete glossary list. |
rulesetIds | Optional array of unique ruleset IDs. It becomes the engine's complete ruleset list. |
brandVoiceId | Optional brand voice ID, or null to detach the current one. An engine holds one brand voice. |
Each list you send replaces that kind of attachment: sets missing from it are detached, and new ones are attached. [] detaches every set of that kind. A field you omit leaves that kind unchanged, so { "attachments": { "rulesetIds": [...] } } keeps the engine's glossaries.
The response is the updated engine; check attachments in it. The whole update is one change: if any ID is unreachable, the request fails with AttachmentsUnreachable and no attachment or other field is changed.
To read the current lists, read the engine and use attachments.glossaryIds and attachments.rulesetIds. GET /v2/engines/:id/rulesets returns the attached rulesets in full, in the order they were attached, with the fields of a ruleset.
List the terms an engine applies #
GET /v2/engines/:engineId/glossary-terms?limit=50
X-API-Key: YOUR_API_KEYThe response lists the terms of every glossary attached to the engine, grouped by glossary. It takes the same filters and pagination as listing a glossary's terms, and returns the same data and meta shape. Reading the engine is enough; the caller needs no access to the glossaries themselves.
Each term carries its glossaryId. The same text in two attached glossaries appears as two terms. To change a listed term, use its glossaryId and id with the term routes, which need edit access to that glossary.
Delete attached sets #
A glossary or ruleset cannot be deleted while any engine applies it. The delete returns GlossaryInUse or RulesetInUse (409), whose engineCount says how many engines still apply it:
{
"type": "https://lingo.dev/docs/api/errors/glossary-in-use",
"title": "Glossary in use",
"status": 409,
"detail": "Glossary gls_example cannot be deleted while 1 engine applies it. Detach it from those engines first.",
"id": "gls_example",
"engineCount": 1
}Detach the set from each of those engines, or delete the engines, and then delete it. engineCount is null when an engine attached the set while the delete was running.