latestOpenAPI 3.0.02026-08-105585620.8 KB

18e2f2e178dd

File Library API

Add a new file

Adds a new File to the library by providing URL of the file.

If a file with identical URL already exists, then the original file is returned. If a file does not exist, a new file is created.

See examples

post/files

Headers

X-PF-Store-Idstring

Use this to specify which store you want to use (required only for account level token).

The store IDs can be retrieved with the Get basic information about stores endpoint.

Request body

typestring

Role of the file

idinteger

File ID

urlstring required

Source URL where the file is downloaded from. The use of .ai .psd and .tiff files have been depreciated, if your application uses these file types or accepts these types from users you will need to add validation.

hashstring

MD5 checksum of the file

filenamestring

File name

mime_typestring

MIME type of the file

sizeinteger

Size in bytes

widthinteger

Width in pixels

heightinteger

Height in pixels

dpiinteger

Resolution DPI.<br>Note: for vector files this may be indicated as only 72dpi, but it doesn't affect print quality since the vector files are resolution independent.

statusstring

File processing status:<br>ok - file was processed successfuly<br>waiting - file is being processed<br>failed - file failed to be processed

createdinteger

File creation timestamp

thumbnail_urlstring

Small thumbnail URL

preview_urlstring

Medium preview image URL

visibleboolean

Show file in the Printfile Library (default true)

is_temporaryboolean

Whether it is a temporary printfile.

Example request

{
  "type": "default",
  "id": 10,
  "url": "​https://www.example.com/files/tshirts/example.png",
  "options": [
    {
      "id": "template_type",
      "value": "native"
    }
  ],
  "hash": "ea44330b887dfec278dbc4626a759547",
  "filename": "shirt1.png",
  "mime_type": "image/png",
  "size": 45582633,
  "width": 1000,
  "height": 1000,
  "dpi": 300,
  "status": "ok",
  "created": 1590051937,
  "thumbnail_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png",
  "preview_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png",
  "visible": true
}

Response

OK

codeinteger

Response status code 200

Example response

{
  "code": 200,
  "result": {
    "type": "default",
    "id": 10,
    "url": "​https://www.example.com/files/tshirts/example.png",
    "options": [
      {
        "id": "template_type",
        "value": "native"
      }
    ],
    "hash": "ea44330b887dfec278dbc4626a759547",
    "filename": "shirt1.png",
    "mime_type": "image/png",
    "size": 45582633,
    "width": 1000,
    "height": 1000,
    "dpi": 300,
    "status": "ok",
    "created": 1590051937,
    "thumbnail_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png",
    "preview_url": "https://files.cdn.printful.com/files/ea4/ea44330b887dfec278dbc4626a759547_thumb.png",
    "visible": true
  }
}