# Get Generated Document By ID

- Sandbox: `GET https://sandbox.payme.io/api/documents/document_id`
- Production: `GET https://live.payme.io/api/documents/document_id`

## Credentials

- Header `PayMe-Merchant-Key` (required)

## Overview

In order to query for existing documents, you will need to use the following endpoint and parameters:
 
Environment | URL
---|---
`Sandbox`| `https://sandbox.payme.io/api/documents?page=0&limit=5&field=createdAt&sort=desc`
`Production` | `https://live.payme.io/api/documents?page=0&limit=5&field=createdAt&sort=desc`

##### Header
Parameter | Description 
---|---
`PayMe-Merchant-Key` | Seller's MPL `DEMOMPL-DEMOMPL-DEMOMPL-DEMOMPL-`

### Request Example:

Item | Description | Example
---|---|---
URL | `https://sandbox.payme.io/api/documents/{document_ID}` |  `INV12321*****`
Header| `seller_payme_id` | `MPLDEMO-MPLDEMO-MPLDEMO-MPLDEMO`

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `PayMe-Merchant-Key` | header | string | yes |  |

## Code samples

### curl

```bash
curl -X GET 'https://sandbox.payme.io/api/documents/document_id' \
  -H 'PayMe-Merchant-Key: <PayMe-Merchant-Key>'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/documents/document_id", {
  method: "GET",
  headers: {
    "PayMe-Merchant-Key": "<PayMe-Merchant-Key>",
  },
});

console.log(await response.text());
```

### Python

```python
import requests

response = requests.get(
    "https://sandbox.payme.io/api/documents/document_id",
    headers={
        "PayMe-Merchant-Key": "<PayMe-Merchant-Key>",
    },
)

print(response.text)
```

### PHP

```php
<?php

$ch = curl_init('https://sandbox.payme.io/api/documents/document_id');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'PayMe-Merchant-Key: <PayMe-Merchant-Key>',
    ],
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```

## Responses

No responses are documented for this endpoint.
