# Organization Documents API

Used by organizations to query and fetch documents that are registered to their national ID. The API is only available through [x-road](https://docs.devland.is/products/x-road "mention")

## Authentication

The [auth](https://docs.devland.is/products/auth "mention") with client credentials flow is used for authentication.

Organizations can integrate with this service by:

1. Creating a Machine to Machine Client (Application) in the IDS Admin.
2. Requesting API access for the client via Island.is support.

## API

#### Document List

Returns a list of documents registered to the organization. A maximum of 100 items can be retrieved in each request.

## GET /api/v1/Documents

>

```json
{"openapi":"3.0.4","info":{"title":"IslandIs Documents API V1","version":"v1"},"tags":[{"name":"Documents"}],"paths":{"/api/v1/Documents":{"get":{"tags":["Documents"],"parameters":[{"name":"senderKennitala","in":"query","schema":{"type":"string"}},{"name":"dateFrom","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"dateTo","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"categoryId","in":"query","schema":{"type":"string"}},{"name":"typeId","in":"query","schema":{"type":"string"}},{"name":"archived","in":"query","schema":{"type":"boolean","default":false}},{"name":"order","in":"query","schema":{"$ref":"#/components/schemas/Order"}},{"name":"opened","in":"query","schema":{"type":"boolean"}},{"name":"page","in":"query","schema":{"type":"integer","format":"int32","default":1}},{"name":"pageSize","in":"query","schema":{"type":"integer","format":"int32","default":15}},{"name":"bookmarked","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentListView"}}}},"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"Order":{"enum":["Ascending","Descending"],"type":"string"},"DocumentListView":{"type":"object","properties":{"documents":{"type":"array","items":{"$ref":"#/components/schemas/DocumentListItem"}},"unreadCount":{"type":"integer","format":"int32"},"totalCount":{"type":"integer","format":"int32"}},"additionalProperties":false},"DocumentListItem":{"required":["categoryId","senderName","senderNationalId","subject"],"type":"object","properties":{"id":{"type":"string","format":"uuid"},"documentDate":{"type":"string","format":"date-time"},"publicationDate":{"type":"string","format":"date-time","nullable":true},"senderNationalId":{"type":"string"},"senderName":{"type":"string"},"subject":{"type":"string"},"categoryId":{"type":"string"},"opened":{"type":"boolean"},"bookmarked":{"type":"boolean"},"urgent":{"type":"boolean"},"replyable":{"type":"boolean"}},"additionalProperties":false},"ErrorResponse":{"type":"object","properties":{"title":{"type":"string"},"status":{"type":"integer","format":"int32"},"detail":{"type":"string"},"instance":{"type":"string"}},"additionalProperties":false}}}}
```

#### Get Document

Retrieves the document and its contents. Three content types are supported, only one content type is used per document. \
\
`content` is a base64 string of the documents content\
`htmlContent` is plaintext HTML\
`urlContent` is a URL linking to the document

## GET /api/v1/Documents/{documentId}

>

```json
{"openapi":"3.0.4","info":{"title":"IslandIs Documents API V1","version":"v1"},"tags":[{"name":"Documents"}],"paths":{"/api/v1/Documents/{documentId}":{"get":{"tags":["Documents"],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDTO"}}}},"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"DocumentDTO":{"required":["fileType"],"type":"object","properties":{"fileType":{"type":"string"},"content":{"type":"string","nullable":true},"htmlContent":{"type":"string","nullable":true},"urlContent":{"type":"string","nullable":true}},"additionalProperties":false},"ErrorResponse":{"type":"object","properties":{"title":{"type":"string"},"status":{"type":"integer","format":"int32"},"detail":{"type":"string"},"instance":{"type":"string"}},"additionalProperties":false}}}}
```

#### Read Document

Marks document as read

## POST /api/v1/Documents/{documentId}/read

>

```json
{"openapi":"3.0.4","info":{"title":"IslandIs Documents API V1","version":"v1"},"tags":[{"name":"Documents"}],"paths":{"/api/v1/Documents/{documentId}/read":{"post":{"tags":["Documents"],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"ErrorResponse":{"type":"object","properties":{"title":{"type":"string"},"status":{"type":"integer","format":"int32"},"detail":{"type":"string"},"instance":{"type":"string"}},"additionalProperties":false}}}}
```

#### Archive Document

Sets the documents archived status

## POST /api/v1/Documents/{documentId}/archive

>

```json
{"openapi":"3.0.4","info":{"title":"IslandIs Documents API V1","version":"v1"},"tags":[{"name":"Documents"}],"paths":{"/api/v1/Documents/{documentId}/archive":{"post":{"tags":["Documents"],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentArchiveRequest"}},"text/json":{"schema":{"$ref":"#/components/schemas/DocumentArchiveRequest"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/DocumentArchiveRequest"}}}},"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"DocumentArchiveRequest":{"type":"object","properties":{"archived":{"type":"boolean"}},"additionalProperties":false},"ErrorResponse":{"type":"object","properties":{"title":{"type":"string"},"status":{"type":"integer","format":"int32"},"detail":{"type":"string"},"instance":{"type":"string"}},"additionalProperties":false}}}}
```

#### Bookmark Document

Sets the documents bookmarked status

## POST /api/v1/Documents/{documentId}/bookmark

>

```json
{"openapi":"3.0.4","info":{"title":"IslandIs Documents API V1","version":"v1"},"tags":[{"name":"Documents"}],"paths":{"/api/v1/Documents/{documentId}/bookmark":{"post":{"tags":["Documents"],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentBookmarkRequest"}},"text/json":{"schema":{"$ref":"#/components/schemas/DocumentBookmarkRequest"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/DocumentBookmarkRequest"}}}},"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"DocumentBookmarkRequest":{"type":"object","properties":{"bookmarked":{"type":"boolean"}},"additionalProperties":false},"ErrorResponse":{"type":"object","properties":{"title":{"type":"string"},"status":{"type":"integer","format":"int32"},"detail":{"type":"string"},"instance":{"type":"string"}},"additionalProperties":false}}}}
```

#### Document Types

Returns all document types associated with the organization’s documents

## GET /api/v1/Documents/types

>

```json
{"openapi":"3.0.4","info":{"title":"IslandIs Documents API V1","version":"v1"},"tags":[{"name":"Documents"}],"paths":{"/api/v1/Documents/types":{"get":{"tags":["Documents"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MessageTypeDTO"}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"MessageTypeDTO":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"additionalProperties":false},"ErrorResponse":{"type":"object","properties":{"title":{"type":"string"},"status":{"type":"integer","format":"int32"},"detail":{"type":"string"},"instance":{"type":"string"}},"additionalProperties":false}}}}
```

#### Document Categories

Returns all document categories associated with the organization’s documents

## GET /api/v1/Documents/categories

>

```json
{"openapi":"3.0.4","info":{"title":"IslandIs Documents API V1","version":"v1"},"tags":[{"name":"Documents"}],"paths":{"/api/v1/Documents/categories":{"get":{"tags":["Documents"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MessageCategoryDTO"}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"MessageCategoryDTO":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"additionalProperties":false},"ErrorResponse":{"type":"object","properties":{"title":{"type":"string"},"status":{"type":"integer","format":"int32"},"detail":{"type":"string"},"instance":{"type":"string"}},"additionalProperties":false}}}}
```

{% embed url="<https://openapi.gitbook.com/o/-MJWAvhHdFCiWEQqlyr6/spec/DocumentsAPI.json>" %}


---

# 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.devland.is/products/postholf/organization-documents-api.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.
