Files

Learn how to use the Files resource.

When you upload a file to Digital River using the Files API, Digital River returns a unique reference identifier and other information about the file. You can use the identifier in other API calls.

A file is an object that represents a file hosted on Digital River's servers.

You can upload a file to the Digital River server using the create file request (for example, a US tax certificate for your customer). The uploaded file must conform to RFC 2238.

You can also use a file created by Digital River (for example, a customer tax invoice).

The Files resource allows you to:

Create a file

To create a file, issue a send a multipart/form-data to https://api.digitalriver.com/files.

Request header example
POST https://api.digitalriver.com/files
Authorization:[bearer {secret key}]
Accept:[application/json]

Create a file for a tax certificate by including the following information in the body like this:

Request body example
{
"purpose": "tax_document_customer_upload",
"file": "@/path/file.jpg"
"fileName": "file.png"
"title": "My 2019 Tax Certificate."
"linkExpiresTime": "2020-04-25T20:36:00Z"
}

The following table describes the valid purpose values, each with file format and size requirements.

Purpose

Description

Supported File Formats

Max size

customer_tax_invoice

A customer tax invoice.

PDF

customer_credit_memo

A customer credit memo.

PDF

tax_document_customer_upload

A user-uploaded tax document.

CSV, JPG, PDF, PNG

16MB

A successful request returns a File object.

File object example
{
"id": "file_09e2464f-9b4f-482b-ae89-732183c705be",
"createdTime": "2018-04-25T20:36:00Z",
"fileName": "file.png",
"purpose": "tax_document_customer_upload",
"title": "My 2019 Tax Certificate.",
"size": 72334,
"type": "png",
"url": "https://files.digitalriver.com/files/file_17a0cab7-1ff7-478e-99f9-d4e753dec24d/contents",
"liveMode": false
}

Retrieve a file

To retrieve a single file, send a GET request to https://api.digitalriver.com/files and provide the file identifier.

Request header example
GET https://files.digitalriver.com/files/:09e2464f-9b4f-482b-ae89-732183c705be
Authorization:[bearer {secret key}]
Accept:[application/json]

A successful request returns a File object.

File object example
{
"id": "file_09e2464f-9b4f-482b-ae89-732183c705be",
"createdTime": "2018-04-25T20:36:00Z",
"fileName": "file.png",
"links": [
{
"id": "link_d992b05c-31d3-485e-b1f7-7b95f06cbfe8",
"createdTime": "2018-04-25T20:36:00Z",
"expired": false,
"expiresTime": "2020-04-25T20:36:00Z",
"liveMode": false,
"url": "https://files.digitalriver.com/links/fl_29a093a2-8989-4def-a50c-d8950d1436d4"
}
],
"purpose": "tax_document_customer_upload",
"title": "My 2019 Tax Certificate.",
"size": 72334,
"type": "png",
"url": "https://files.digitalriver.com/files/file_17a0cab7-1ff7-478e-99f9-d4e753dec24d/contents",
"liveMode": false
}

Return a list of all files

To retrieve a list of all files, send a GET request to https://api.digitalriver.com/files.

Request header example
GET https://files.digitalriver.com/files
Authorization:[bearer {secret key}]
Accept:[application/json]

A successful request returns the File object.

File object example
{
"hasMore": true,
"data": [
{
"id": "file_09e2464f-9b4f-482b-ae89-732183c705be",
"createdTime": "2018-04-25T20:36:00Z",
"fileName": "file.png",
"links": [
{
"id": "link_d992b05c-31d3-485e-b1f7-7b95f06cbfe8",
"createdTime": "2018-04-25T20:36:00Z",
"expired": false,
"expiresTime": "2020-04-25T20:36:00Z",
"liveMode": false,
"url": "https://files.digitalriver.com/links/fl_29a093a2-8989-4def-a50c-d8950d1436d4"
}
],
"purpose": "tax_document_customer_upload",
"title": "My 2019 Tax Certificate.",
"size": 72334,
"type": "png",
"url": "https://files.digitalriver.com/files/file_17a0cab7-1ff7-478e-99f9-d4e753dec24d/contents",
"liveMode": false
}
]
}