# Documents

#### `POST /participants/documents` <a href="#post-participants-documents" id="post-participants-documents"></a>

```
const postParticipantDocument = (filepath) => {
  const document = fs.readFileSync(filepath).toString('base64')

  const body = {
    document,
    mime: 'pdf',
    file_name: 'supporting_document.pdf',
    participant_code: 'ABC123'
  }

  const timestamp = Math.round(Date.now() / 1000)
  const payload = timestamp + 'POST' + '/participants/documents' + JSON.stringify(
    {})
  const decodedSecret = Buffer.from(apiSecret, 'base64')
  const hmac = crypto.createHmac('sha256', decodedSecret)
  const signedPayload = hmac.update(payload).digest('base64')

  const fileHash = crypto
    .createHash('sha256')
    .update(body.document)
    .digest('base64')

  // SET HEADERS
 const headers = {
    'X-NDAX-API-KEY': 'public_key',
    'X-NDAX-SIGNED': signedPayload,
    'X-NDAX-TIMESTAMP': timestamp,
    'X-NDAX-PASSPHRASE': 'passphrase'
  }
  const options = {
    headers,
    body,
    json: true
  }

  return request.post(
    `https://api.ndax.in/participants/documents`,
    options
  )
}
```

> Sample Request

```
{
  "document": "aGVsbG8gd29ybGQ=",
  "mime": "pdf",
  "file_name": "supporting_document.pdf",
  "participant_code": "ABC123"
}
```

> Sample Response

```
{
  "message": {
    "state": "Success",
    "file_name": "supporting_document.pdf",
    "created_at": 1572899177383
  }
}
```

Submits a document on behalf of you or a customer if you operate a platform on NDAX. In order to Authenticate you will need to do the following:

* Set your X-NDAX-FILE-HASH header to the sha256 hash (in a byte array) of your file contents and encode this data to base64 string.
* Make sure to use `{}` as your body when signing your request. If you use your actual request body to sign you will receive and `Invalid Client Signature`.
* Ensure that your file is not larger than 10mb.
* Remember to base 64 encode your file before sending it to us.

&#x20;You will need to add an additional "X-NDAX-FILE-HASH" header to make this request.

Request body:

<table><thead><tr><th width="198.33333333333331">Parameter</th><th width="470">Description</th><th>Type</th></tr></thead><tbody><tr><td>document</td><td>base 64 encoded file that you wish to upload (10mb limit)</td><td>binary</td></tr><tr><td>mime</td><td>The MIME type of the file you are uploading</td><td>string</td></tr><tr><td>file_name</td><td>The name of the document that you are uploading</td><td>string</td></tr><tr><td>participant_code</td><td>Your participant code, or the participant_code of the customer on behalf of whom you are uploading the document</td><td>string</td></tr></tbody></table>
