# Hent dokumentindhold

{% openapi src="<https://github.com/skydeckai/rememberizer-docs/blob/production/da/.gitbook/assets/rememberizer_openapi.yml>" path="/documents/{document\_id}/contents/" method="get" %}
<https://github.com/skydeckai/rememberizer-docs/blob/production/da/.gitbook/assets/rememberizer_openapi.yml>
{% endopenapi %}

## Eksempelanmodninger

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

```bash
curl -X GET \
  "https://api.rememberizer.ai/api/v1/documents/12345/contents/?start_chunk=0&end_chunk=20" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

{% hint style="info" %}
Erstat `YOUR_JWT_TOKEN` med din faktiske JWT-token og `12345` med et faktisk dokument-ID.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const getDocumentContents = async (documentId, startChunk = 0, endChunk = 20) => {
  const url = new URL(`https://api.rememberizer.ai/api/v1/documents/${documentId}/contents/`);
  url.searchParams.append('start_chunk', startChunk);
  url.searchParams.append('end_chunk', endChunk);
  
  const response = await fetch(url.toString(), {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN'
    }
  });
  
  const data = await response.json();
  console.log(data);
  
  // Hvis der er flere chunks, kan du hente dem
  if (data.end_chunk < totalChunks) {
    // Hent det næste sæt af chunks
    await getDocumentContents(documentId, data.end_chunk, data.end_chunk + 20);
  }
};

getDocumentContents(12345);
```

{% hint style="info" %}
Erstat `YOUR_JWT_TOKEN` med din faktiske JWT-token og `12345` med et faktisk dokument-ID.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests

def get_document_contents(document_id, start_chunk=0, end_chunk=20):
    headers = {
        "Authorization": "Bearer YOUR_JWT_TOKEN"
    }
    
    params = {
        "start_chunk": start_chunk,
        "end_chunk": end_chunk
    }
    
    response = requests.get(
        f"https://api.rememberizer.ai/api/v1/documents/{document_id}/contents/",
        headers=headers,
        params=params
    )
    
    data = response.json()
    print(data)
    
    # Hvis der er flere chunks, kan du hente dem
    # Dette er et simpelt eksempel - du vil måske implementere en ordentlig rekursionskontrol
    if 'end_chunk' in data and data['end_chunk'] < total_chunks:
        get_document_contents(document_id, data['end_chunk'], data['end_chunk'] + 20)

get_document_contents(12345)
```

{% hint style="info" %}
Erstat `YOUR_JWT_TOKEN` med din faktiske JWT-token og `12345` med et faktisk dokument-ID.
{% endhint %}
{% endtab %}
{% endtabs %}

## Sti Parametre

| Parameter    | Type    | Beskrivelse                                                       |
| ------------ | ------- | ----------------------------------------------------------------- |
| document\_id | integer | **Påkrævet.** ID'et på dokumentet, som indholdet skal hentes for. |

## Forespørgselsparametre

| Parameter    | Type    | Beskrivelse                                                  |
| ------------ | ------- | ------------------------------------------------------------ |
| start\_chunk | integer | Den startende chunk-indeks. Standard er 0.                   |
| end\_chunk   | integer | Den afsluttende chunk-indeks. Standard er start\_chunk + 20. |

## Responsformat

```json
{
  "content": "Den fulde tekstindhold af dokumentchunkene...",
  "end_chunk": 20
}
```

## Fejlbeskeder

| Statuskode | Beskrivelse          |
| ---------- | -------------------- |
| 404        | Dokument ikke fundet |
| 500        | Intern serverfejl    |

## Pagination for Store Dokumenter

For store dokumenter opdeles indholdet i bidder. Du kan hente det fulde dokument ved at foretage flere anmodninger:

1. Foretag en indledende anmodning med `start_chunk=0`
2. Brug den returnerede `end_chunk` værdi som `start_chunk` for den næste anmodning
3. Fortsæt, indtil du har hentet alle bidder

Denne endpoint returnerer det rå tekstindhold af et dokument, hvilket giver dig mulighed for at få adgang til de fulde oplysninger til detaljeret behandling eller analyse.


---

# Agent Instructions: 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:

```
GET https://docs.rememberizer.ai/da/udviklerressourcer/api-docs/retrieve-document-contents.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
