Composable Frontend 2.0 Learn more 

  • Products/
    Product Assets/
    Files API Overview

    Files API Overview

    The Files API is for Administrator use only. Do not use these endpoints on your customer-facing frontends.

    You can upload image files or URLs by using multipart/form-data as the content type header. For example, "Content-Type: multipart/form-data" \. Commerce supports the following file types.

    File ExtensionDescription
    .gifGraphics Interchange Format (GIF)
    .jpg/jpegJoint Photographic Experts Group (JPEG) format
    .pngPortable graphics format
    .webpWeb picture format
    .mp4Moving Picture Experts Group (MPEG) format
    .movQuickTime Movie format
    .pdfPortable Document Format
    .svgScalable Vector Graphics format
    .usdzUniversal Scene Description Format
    .glbGlobal File format
    .jp2Compressed bitmap image saved in Joint Photographic Experts Group (JPEG) format
    .jxrExtended range for Joint Photographic Experts Group (JPEG) format
    .aacAdvanced Audio Coding (AAC) format
    .vrmlVirtual Reality Modelling Language (VRML) format
    .doc(x)Microsoft Word Open XML format
    .ppt(x)Microsoft PowerPoint Open XML format
    .xls(x)Microsoft Excel Open XML format

    By default, the maximum file size is 8 MB. If you need to support larger file sizes, contact your Elastic Path representative. Alternatively, store files somewhere else and reference them.

    The File object

    AttributeTypeDescription
    idstringThe unique identifier for this file.
    typestringThe type represents the object being returned.
    linkobjectThe file link object.
    file_namestringThe name of the file.
    mime_typestringThe mime type of the file.
    file_sizeintegerThe size of the file. Required when uploading files.
    DEPRECATED publicbooleanWhether the file public or not. Required when uploading files.
    file_locationstringThe URL that points to an image. Required when referencing files stored externally.
    metaobjectThe additional meta object.
    linksobjectThe file links object.
    AttributeTypeDescription
    link.hrefstringThe publicly available URL for this file.

    The file meta object

    AttributeTypeDescription
    meta.dimensions.widthintegerThe width of the file.
    meta.dimensions.heightintegerThe height of the file.
    meta.timestamps.created_atstringThe creation date of the file.
    AttributeTypeDescription
    links.selfstringThe URL of this file object.

    Response Example

    {
      "data": {
        "id": "272d3ff0-5034-4986-8786-0ff97450745d",
        "type": "file",
        "link": {
          "href": "https://files-eu.epusercontent.com/2a85964e-cb3d-482a-ab02-0f0e47ab5662/273d3ff0-5034-4986-8786-0ff97450745.jpg"
        },
        "file_name": "image.jpg",
        "mime_type": "image/jpeg",
        "file_size": 20953,
        "meta": {
          "dimensions": {
            "width": 1600,
            "height": 800
          },
          "timestamps": {
            "created_at": "2017-08-14T10:47:45.191Z"
          }
        },
        "links": {
          "self": "https://useast.api.elasticpath.com/v2/files/272d3ff0-5034-4986-8786-0ff97450745d"
        }
      }
    }
    
    Previous
    Overview