LogoLogo
System Status
2021-12-13
2021-12-13
  • 2021-12-13
  • Charges
    • Charge basics
  • Checkouts
  • Country specifications
  • Customers
  • Events
  • Fees
  • File Links
    • File link basics
  • Files
    • File basics
  • Fulfillments
  • Fulfillment cancellations
  • Fulfillment orders
  • Fulfillment returns
  • Inventory items
  • Inventory levels
  • Invoices
    • Invoice basics
  • Logistics returns
  • Orders
    • Order basics
  • Payouts
  • Plans
    • Plan basics
  • Refunds
  • Reservations
  • Returns
  • Sales summaries
  • Sales transactions
  • Shipments
  • Shipping labels
  • Shipping quotes
  • SKUs
  • SKU Groups
  • Sources
  • Subscriptions
    • Subscription basics
  • Tax identifiers
  • Webhooks
  • Drop-in checkout links
  • Drop-in checkout sessions
    • Checkout-sessions basics
  • Drop-in shipping quotes
  • Store credit callout
Powered by GitBook
On this page
  • Creating a file
  • Defining a file
  • Submitting a create file request
  • The File object
  • Unique identifier
  • Links
  • Size and type
  • URL
  • Using a file
  • Downloading a file for internal use
  • Creating a publicly accessible link
  1. Files

File basics

Learn about the files resource.

PreviousFilesNextFulfillments

Last updated 2 months ago

The represents a customer-related document that is hosted on Digital River's servers. You can use the to upload, retrieve, search for, download, and delete files.

Every contains a unique identifier, which you can use to or .

Creating a file

To upload a customer's tax documents to our servers, and then .

Defining a file

When defining a file, you're only required to designate a . Providing a , along with specifying a , are optional values.

File and purpose

In the request, file should adhere to the specification, which defines file transfers for the multipart/form-data protocol.

The purpose parameter should describe the function of the file.

If you're providing Digital River with a customer's tax document, set purpose to tax_document_customer_upload. For details, refer to on the page.

For some , Digital River generates a whose purpose is customer_tax_invoice and/or customer_credit_memo. For details, refer to .

Name and title

In the request, you have the option of sending a fileName that is suitable for saving to a filesystem as well as a user-friendly title for the document.

Link expiration

If you provide a linkExpiresTime, make sure the value adheres to the used in the Digital River APIs.

Submitting a create file request

curl https://api.digitalriver.com/files \
     -u <API_key>: \
     -d file="@/path/file.jpg" \
     -d purpose="tax_document_customer_upload" \
     -d fileName="file.png" \
     -d title="My 2019 Tax Certificate."
{
  "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
}

The File object

{
    "id": "62e30acb-1c24-40fc-8a98-db8e3d479c78",
    "createdTime": "2021-05-24T09:10:49Z",
    "fileName": "GCINIE6426071CGB20190000000000284082939532120039586.pdf",
    "links": [
        {
            "id": "7e20a925-32b1-434b-b704-366b19b8afd2",
            "createdTime": "2021-05-24T22:11:54Z",
            "expired": false,
            "expiresTime": "2021-05-26T13:47:13Z",
            "liveMode": false,
            "url": "https://files-test.digitalriver.com/links/7e20a925-32b1-434b-b704-366b19b8afd2"
        }
    ],
    "purpose": "customer_invoice",
    "title": "customer invoice",
    "size": 35776,
    "type": "pdf",
    "url": "https://api.digitalriver.com/files/62e30acb-1c24-40fc-8a98-db8e3d479c78/content",
    "liveMode": false
}

Unique identifier

Links

Size and type

A file's size is represented in bytes, and its type signifies a format (e.g. pdf, jpg, or png).

URL

Using a file

Downloading a file for internal use

A request sent with the wrong key returns a 401 Unauthorized response status code.

{
    "type": "unauthorized",
    "errors": [
        {
            "message": "An authorization error has occurred."
        }
    ]
}

Creating a publicly accessible link

In your requests, set the Content-Type header to multipart/form-data:

A 201 Created response returns a :

You can use id to , , and . You'll also need it to to share with customers.

Files may contain an array of publicly accessible . If no links have been generated, however, then links[] does not exist.

The url allows you to .

Once a file is created, you can or .

You can use to download a document for internal use. But to , you must provide your .

As a result, don't share url with your customers. if you'd like to provide them access to a document.

To share files with customers, .

file links
File object
download a file for internal use
download it for internal use
create a publicly accessible link
Create a public link
Files resource
Files API
RFC 2388
orders
file
File object
download a file for internal use
create a publicly-accessible link to a document
define a file
submit a create file request
file and its purpose
name and title
link expiration time
create a file link
url
create a file link
POST /files
retrieve
search for
delete files
get the file's content
secret (confidential) API key
date and time format
Collecting tax certificates
Setting up tax exemptions
Accessing invoices and credit memos