> For the complete documentation index, see [llms.txt](https://guides.ia.numerique.gouv.fr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guides.ia.numerique.gouv.fr/albert-api/api-reference/liste-des-endpoint/chunks.md).

# Chunks

## Get Chunk

> Get a chunk of a document.

```json
{"openapi":"3.1.0","info":{"title":"Albert API","version":"0.4.9"},"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}},"schemas":{"Chunk":{"properties":{"object":{"type":"string","const":"chunk","title":"Object","description":"The type of the object.","default":"chunk"},"id":{"type":"integer","minimum":0,"title":"Id","description":"The ID of the chunk."},"collection_id":{"type":"integer","minimum":0,"title":"Collection Id","description":"The ID of the collection the chunk belongs to."},"document_id":{"type":"integer","minimum":0,"title":"Document Id","description":"The ID of the document the chunk belongs to."},"content":{"type":"string","minLength":1,"title":"Content","description":"The content of the chunk."},"metadata":{"anyOf":[{"additionalProperties":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"integer","maximum":10000000000000000,"minimum":-10000000000000000},{"type":"number","maximum":10000000000000000,"minimum":-10000000000000000},{"type":"boolean"}]},"propertyNames":{"maxLength":255,"minLength":1},"type":"object","maxProperties":10,"minProperties":1,"description":"Extra metadata for the source"},{"type":"null"}],"title":"Metadata","description":"Metadata of the chunk"},"created":{"type":"integer","title":"Created","description":"The date of the chunk creation."}},"additionalProperties":true,"type":"object","required":["id","collection_id","document_id","content"],"title":"Chunk"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/chunks/{document}/{chunk}":{"get":{"tags":["Chunks"],"summary":"Get Chunk","description":"Get a chunk of a document.","operationId":"get_chunk_v1_chunks__document___chunk__get","deprecated":true,"parameters":[{"name":"document","in":"path","required":true,"schema":{"type":"integer","description":"The document ID","title":"Document"},"description":"The document ID"},{"name":"chunk","in":"path","required":true,"schema":{"type":"integer","description":"The chunk ID","title":"Chunk"},"description":"The chunk ID"},{"name":"required","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Required"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Chunk"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get Chunks

> Get chunks of a document.

```json
{"openapi":"3.1.0","info":{"title":"Albert API","version":"0.4.9"},"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}},"schemas":{"Chunks":{"properties":{"object":{"type":"string","const":"list","title":"Object","description":"The type of the object.","default":"list"},"data":{"items":{"$ref":"#/components/schemas/Chunk"},"type":"array","title":"Data","description":"The list of chunks."}},"additionalProperties":true,"type":"object","required":["data"],"title":"Chunks"},"Chunk":{"properties":{"object":{"type":"string","const":"chunk","title":"Object","description":"The type of the object.","default":"chunk"},"id":{"type":"integer","minimum":0,"title":"Id","description":"The ID of the chunk."},"collection_id":{"type":"integer","minimum":0,"title":"Collection Id","description":"The ID of the collection the chunk belongs to."},"document_id":{"type":"integer","minimum":0,"title":"Document Id","description":"The ID of the document the chunk belongs to."},"content":{"type":"string","minLength":1,"title":"Content","description":"The content of the chunk."},"metadata":{"anyOf":[{"additionalProperties":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"integer","maximum":10000000000000000,"minimum":-10000000000000000},{"type":"number","maximum":10000000000000000,"minimum":-10000000000000000},{"type":"boolean"}]},"propertyNames":{"maxLength":255,"minLength":1},"type":"object","maxProperties":10,"minProperties":1,"description":"Extra metadata for the source"},{"type":"null"}],"title":"Metadata","description":"Metadata of the chunk"},"created":{"type":"integer","title":"Created","description":"The date of the chunk creation."}},"additionalProperties":true,"type":"object","required":["id","collection_id","document_id","content"],"title":"Chunk"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/chunks/{document}":{"get":{"tags":["Chunks"],"summary":"Get Chunks","description":"Get chunks of a document.","operationId":"get_chunks_v1_chunks__document__get","deprecated":true,"parameters":[{"name":"document","in":"path","required":true,"schema":{"type":"integer","description":"The document ID","title":"Document"},"description":"The document ID"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"The number of documents to return","default":10,"title":"Limit"},"description":"The number of documents to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","description":"The offset of the first document to return","default":0,"title":"Offset"},"description":"The offset of the first document to return"},{"name":"required","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Required"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Chunks"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```


---

# 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://guides.ia.numerique.gouv.fr/albert-api/api-reference/liste-des-endpoint/chunks.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.
