> For the complete documentation index, see [llms.txt](https://docs.gitloom.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gitloom.cloud/api-reference/vocabulary.md).

# Vocabulary

Teach a namespace the terms and abbreviations its memories are written in.

A namespace's custom vocabulary is the domain terms and abbreviations it has learned. Search **expands a query across a term's surface forms**, so once a namespace knows `k8s` means `kubernetes`, a query for either finds memories written with the other. A query that mentions a defined term also gets the definition back, as `defined` on the retrieve response — usually the single most relevant thing the namespace holds about that word.

#### POST /v1/vocab

Teach terms. Learning one the namespace already has rewrites it, so this is how aliases get refined.

{% hint style="warning" %}
**Asynchronous**, like every write. The response is `202`; the terms land in seconds.
{% endhint %}

| field       | type   | required | notes                 |
| ----------- | ------ | -------- | --------------------- |
| `terms`     | array  | yes      | up to 200 per request |
| `namespace` | string | no       | defaults to `default` |

Each term is `{term, aliases, definition}`. `term` is at most 120 characters and must contain a letter or digit; `definition` is at most 2,000.

```bash
curl -s -X POST "$GITLOOM_API/v1/vocab" \
  -H "Authorization: Bearer $GITLOOM_KEY" \
  -H "content-type: application/json" \
  -d '{"namespace":"user-8213","terms":[
    {"term":"kubernetes","aliases":["k8s","kube"],"definition":"Container orchestration platform."}]}'
```

```json
{"id":"3f2b9e01-…","namespace":"user-8213","status":"accepted"}
```

| status | code                                            |
| ------ | ----------------------------------------------- |
| `400`  | `no_terms`, `invalid_term`, `invalid_namespace` |
| `404`  | `namespace_not_found`                           |
| `413`  | `too_many_terms`                                |

#### GET /v1/vocab

Without `word`, every learned term. With `word`, the term that surface form belongs to.

| param       | required | default   | notes                                               |
| ----------- | -------- | --------- | --------------------------------------------------- |
| `namespace` | no       | `default` |                                                     |
| `word`      | no       | —         | any surface form to resolve                         |
| `like`      | no       | —         | case-insensitive substring of the term, for listing |
| `limit`     | no       | `200`     | capped at 1000                                      |

{% tabs %}
{% tab title="List" %}

```bash
curl -s -G "$GITLOOM_API/v1/vocab" -H "Authorization: Bearer $GITLOOM_KEY" \
  --data-urlencode "namespace=user-8213" --data-urlencode "like=kube"
```

```json
{
  "namespace": "user-8213",
  "terms": [{"path":"vocab/kubernetes.md","term":"kubernetes","aliases":["k8s","kube"],
             "definition":"Container orchestration platform."}],
  "millis": 1
}
```

{% endtab %}

{% tab title="Resolve one word" %}

```bash
curl -s -G "$GITLOOM_API/v1/vocab" -H "Authorization: Bearer $GITLOOM_KEY" \
  --data-urlencode "namespace=user-8213" --data-urlencode "word=k8s"
```

```json
{
  "namespace": "user-8213", "word": "k8s", "found": true,
  "term": {"path":"vocab/kubernetes.md","term":"kubernetes","aliases":["k8s","kube"]},
  "millis": 1
}
```

`found` is `false` and `term` is absent when the word is unknown.
{% endtab %}
{% endtabs %}

#### DELETE /v1/vocab

Forget terms by their canonical form. Comma-separated, in the query string, so no body is needed.

```bash
curl -s -X DELETE -G "$GITLOOM_API/v1/vocab" \
  -H "Authorization: Bearer $GITLOOM_KEY" \
  --data-urlencode "namespace=user-8213" --data-urlencode "term=kubernetes,postgres"
```

```json
{"id":"3f2b9e01-…","namespace":"user-8213","status":"accepted"}
```

A term that was never learned is skipped rather than failing the batch. `400 missing_term` when `term` is empty.

{% hint style="info" %}
Vocabulary is stored as ordinary files at `vocab/<slug>.md` in the namespace's git repository, so a term has a history like anything else.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gitloom.cloud/api-reference/vocabulary.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
