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

# Documents

### Documents#index

Retrieves all firm documents

```
GET /documents
```

**Query Parameters:**

* Search: returns documents filtered by title.

```
GET /documents?search=some%20title
```

**Response:**

Returns a 200 OK with an array of documents:

```
[
    {
        "id": 1,
        "title": "John Doe's G28",
        "firm_id": 1,
        "client_id": 7,
        "created_at": "2019-09-02T17:56:46.492-05:00",
        "updated_at": "2019-09-02T17:56:46.492-05:00",
        "archived": false,
        "size": 369233,
        "user_id": 3,
        "uploaded_by_email": null,
        "doc_url": "https://app.docketwise.com/documents/:id"
    }
]
```

###

### Documents#show

Returns a single document

```
GET /documents/:id
```

**Response:**

Returns a 200 OK with a single contact:

```
{
    "id": 1,
    "title": "John Doe's G28",
    "firm_id": 1,
    "client_id": 7,
    "created_at": "2019-09-02T17:56:46.492-05:00",
    "updated_at": "2019-09-02T17:56:46.492-05:00",
    "archived": false,
    "size": 369233,
    "user_id": 3,
    "uploaded_by_email": null,
    "doc_url": "https://app.docketwise.com/documents/:id"
}
```

###

### Documents#download

Generates a 1 hour public url for the document to be downloaded.

```
GET /documents/:id/download
```

**Response:**

Returns a 200 OK with a temporary url:&#x20;

```
{
    "url": "https://s3-url.com/path-to-document"
}
```

###

### Documents#**create**

Creates a new document. Keep in mind to send document data inside a document root key.&#x20;

```
POST /documents
```

You should pass a JSON with the following parameters:

* `title string`
* `filename string This needs to include the extension of the doc i.e. pdf.pdf, doc.doc`
* `base64_data string File data should be sent as strict base 64 data`
* `description string`
* `client_id integer`&#x20;
* `matter_id integer`

```
{
	"document": {
		"title": "Test", 
		"base64_data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==", 
		"filename": "img.png",
		"client_id": 8116,
		"matter_id": 1
	}
}
```

**Response:**

Returns a 201 created.&#x20;
