---
title: "List Documents"
description: "Retrieves list of documents in Folder (agenda). Result document list is paged by 50 documents per page. Default sorting is by document id descending (new documents on top of the list). If you do not provide any type parameter only PurchaseInvoices will be returned by default."
---

> Documentation Index
> Fetch the complete documentation index at: /api-docs/llms.txt
> Use this file to discover all available pages before exploring further.

# List Documents

<div class="endpoint-signature"><span data-method="GET">GET</span><code>/api/v1_2/documents</code></div>

Retrieves list of documents in Folder (agenda). Result document list is paged by 50 documents per page. Default sorting is by document id descending (new documents on top of the list). If you do not provide any type parameter only PurchaseInvoices will be returned by default.

In case there are 50 records on the first page there is a chance there are more results. If you want to have the rest of the results you need to repeat the request with incremented page parameter e.g. page=2.

See description for document attributes.

## Query parameters

| Name | Example | Description |
|---|---|---|
| `agenda_id` | &#123;&#123;agenda_id&#125;&#125; | [object Object] |
| `page` | 1 | [object Object] |
| `type[]` | SalesInvoice | — |
| `type[]` | PurchaseInvoice | — |

## Headers

| Name | Example | Description |
|---|---|---|
| `Authorization` | Bearer demo_access_token | — |

## Code examples

### cURL

```curl
curl --request GET 'https://app.datamolino.com/api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice' \
  --header 'Authorization: Bearer demo_access_token'
```
### HTTP

```http
GET /api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice HTTP/1.1
Host: app.datamolino.com
Authorization: Bearer demo_access_token
```
### JavaScript Fetch

```javascript
const response = await fetch("https://app.datamolino.com/api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice", {
  method: "GET",
  headers: {
"Authorization": "Bearer demo_access_token"
  },
});

const data = await response.json();
```
### Node.js Axios

```javascript
import axios from "axios";

const response = await axios({
  method: "get",
  url: "https://app.datamolino.com/api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice",
  headers: {
"Authorization": "Bearer demo_access_token"
  }
});

console.log(response.data);
```
### Python Requests

```python
import requests

url = "https://app.datamolino.com/api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice"
headers = {
  "Authorization": "Bearer demo_access_token"
}

response = requests.request("GET", url, headers=headers)
response.raise_for_status()
print(response.json())
```
### Ruby Net::HTTP

```ruby
require 'json'
require 'net/http'

uri = URI("https://app.datamolino.com/api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer demo_access_token"

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end

puts JSON.parse(response.body)
```
### Ruby on Rails

```ruby
# app/services/datamolino_client.rb
require 'json'
require 'net/http'

class DatamolinoClient
  BASE_URL = "https://app.datamolino.com"

  def initialize(access_token: Rails.application.credentials.dig(:datamolino, :access_token))
@access_token = access_token
  end

  def request_list_documents
uri = URI("#{BASE_URL}/api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{@access_token}"

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

JSON.parse(response.body)
  end
end
```
### PHP Guzzle

```php
<?php

use GuzzleHttp\Client;

$client = new Client();
$response = $client->request('GET', 'https://app.datamolino.com/api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice', [
'headers' => json_decode('{"Authorization":"Bearer demo_access_token"}', true)
]);

echo $response->getBody();
```
### Java OkHttp

```java
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
.url("https://app.datamolino.com/api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice")
.addHeader("Authorization", "Bearer demo_access_token")
.method("GET", null)
.build();

Response response = client.newCall(request).execute();
```
### C# HttpClient

```csharp
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://app.datamolino.com/api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice");
request.Headers.Add("Authorization", "Bearer demo_access_token");

using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
```
### Go Native

```go
client := &http.Client{}
req, err := http.NewRequest("GET", "https://app.datamolino.com/api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice", nil)
if err != nil { panic(err) }
req.Header.Add("Authorization", "Bearer demo_access_token")

res, err := client.Do(req)
if err != nil { panic(err) }
defer res.Body.Close()

body, err := io.ReadAll(res.Body)
if err != nil { panic(err) }
fmt.Println(string(body))
```
### Swift URLSession

```swift
import Foundation

var request = URLRequest(url: URL(string: "https://app.datamolino.com/api/v1_2/documents?agenda_id=12345&page=1&type[]=SalesInvoice&type[]=PurchaseInvoice")!)
request.httpMethod = "GET"
request.setValue("Bearer demo_access_token", forHTTPHeaderField: "Authorization")

let (data, _) = try await URLSession.shared.data(for: request)
print(String(data: data, encoding: .utf8)!)
```

## Responses

### 200 OK

Content type: `application/json; charset=utf-8`

```json
{
  "links": {
"self": {
  "href": "https://beta.datamolino.com/api/v1_2/documents?agenda_id=5652&access_token=demo_access_token"
}
  },
  "documents": [
{
  "links": {
    "self": {
      "href": "https://beta.datamolino.com/api/v1_2/documents/315940"
    }
  },
  "id": 315940,
  "type": "PurchaseInvoice",
  "created_at": "2019-11-05T10:41:06Z",
  "last_modified_at": "2019-11-05T10:41:24Z",
  "state": "templating",
  "comments_count": 2,
  "view_detail": "summary",
  "verificator_response": "ok",
  "parent_document_id": null,
  "preview": "/originals/preview/missing.png",
  "original": "https://files.example.com/datamolino-demo/original/demo-supplier-invoice.pdf?expires=3600&signature=demo_signature",
  "user_file_name": "12_20180427.000158.01.pdf",
  "invoice_type": 0,
  "bank_account": {
    "bban": "",
    "bank_code": "",
    "bic": null,
    "iban": null
  },
  "payment_options": {},
  "data": {
    "header": {
      "locale": "sk_SK",
      "invoice_text": "",
      "invoice_no": "INV-2026-00039",
      "sepa_reference": "",
      "variable_symbol": "",
      "specific_symbol": "",
      "issue_date": null,
      "tax_date": null,
      "due_date": null,
      "currency": "",
      "currency_rate": "1.0",
      "text": "",
      "customer_no": "",
      "purchase_order_no": "",
      "reference": "",
      "delivery_note_no": "",
      "card_no": ""
    }
  },
  "supplier": {
    "name": "",
    "id": "",
    "tax_id": "",
    "vat_id": "",
    "street": "",
    "city": "",
    "postal_code": "",
    "country": "",
    "iban": null,
    "bic": null,
    "bban": null,
    "bank_code": null
  },
  "customer": {
    "name": "",
    "id": "",
    "tax_id": "",
    "vat_id": "",
    "street": "",
    "city": "",
    "postal_code": "",
    "country": "",
    "iban": null,
    "bic": null,
    "bban": null,
    "bank_code": null
  },
  "summary": {
    "shipping": 0,
    "other_cost1": 0,
    "other_cost2": 0,
    "other_cost3": 0,
    "total_discount": 0,
    "payment_amount": 0,
    "paid_deposits": 0,
    "rounding": 0,
    "sub_total": 0,
    "vat_total": 0,
    "total": 0
  },
  "tax_lines": [],
  "items": []
},
{
  "links": {
    "self": {
      "href": "https://beta.datamolino.com/api/v1_2/documents/315939"
    }
  },
  "id": 315939,
  "type": "PurchaseInvoice",
  "created_at": "2019-11-05T10:40:53Z",
  "last_modified_at": "2019-11-05T10:42:47Z",
  "state": "ready",
  "comments_count": 2,
  "view_detail": "summary",
  "verificator_response": "ok",
  "parent_document_id": null,
  "preview": "/originals/preview/missing.png",
  "original": "https://files.example.com/datamolino-demo/original/demo-supplier-invoice.pdf?expires=3600&signature=demo_signature",
  "user_file_name": "14_20180427.000160.01.pdf",
  "invoice_type": 0,
  "bank_account": {
    "bban": "",
    "bank_code": "",
    "bic": null,
    "iban": null
  },
  "payment_options": {},
  "data": {
    "header": {
      "locale": "sk_SK",
      "invoice_text": "Docs (2 sites)",
      "invoice_no": "INV-2026-00039",
      "sepa_reference": "",
      "variable_symbol": "",
      "specific_symbol": "",
      "issue_date": "2017-02-10",
      "tax_date": null,
      "due_date": null,
      "currency": "USD",
      "currency_rate": "1.0",
      "text": " Docs (2 sites)  Free (Legacy)",
      "customer_no": "",
      "purchase_order_no": "",
      "reference": "",
      "delivery_note_no": "",
      "card_no": ""
    }
  },
  "supplier": {
    "name": "Help Scout",
    "id": "",
    "tax_id": "",
    "vat_id": "",
    "street": "",
    "city": "",
    "postal_code": "",
    "country": "",
    "iban": null,
    "bic": null,
    "bban": null,
    "bank_code": null
  },
  "customer": {
    "name": "",
    "id": "",
    "tax_id": "",
    "vat_id": "",
    "street": "",
    "city": "",
    "postal_code": "",
    "country": "",
    "iban": null,
    "bic": null,
    "bban": null,
    "bank_code": null
  },
  "summary": {
    "shipping": 0,
    "other_cost1": 0,
    "other_cost2": 0,
    "other_cost3": 0,
    "total_discount": 0,
    "payment_amount": 0,
    "paid_deposits": 0,
    "rounding": 0,
    "sub_total": 25,
    "vat_total": 0,
    "total": 25
  },
  "tax_lines": [
    {
      "id": 238675,
      "percent": 0,
      "sub_total": 25,
      "vat_total": 0,
      "total": 25,
      "paid_deposits": 0
    }
  ],
  "items": [
    {
      "id": 389631,
      "code": "",
      "name": "Docs (2 sites)",
      "quantity": 0,
      "unit": 0,
      "unit_price": 0,
      "tax_rate": 0,
      "subtotal": 0,
      "tax": 0,
      "total": 25,
      "discount_rate": 0,
      "discount": 0
    },
    {
      "id": 389632,
      "code": "",
      "name": "Free (Legacy)",
      "quantity": 0,
      "unit": 0,
      "unit_price": 0,
      "tax_rate": 0,
      "subtotal": 0,
      "tax": 0,
      "total": 0,
      "discount_rate": 0,
      "discount": 0
    }
  ]
}
  ]
}
```

Source: /api-docs/reference/document-basic-actions/list-documents/index.md
