Content API

/v1/assets

Assets are usually returned as part of an asset field, but sometimes you want to fetch them on their own. See the asset object reference for a full breakdown of how they are returned in an API response.

/v1/assets/{id}

Retrieves a single asset object. Supply the asset ID that you were given in a previous request or have copied from the Contento admin panel.

Request

GET https://app.contento.io/api/v1/assets/a_01jDpv3Enjh6AJFjNNJpM2kxg2 HTTP/1.1
Authorization: Bearer {token}
X-CONTENTO-SITE: {site_id}

Response

An asset object with timestamps.

{
  "id": "a_01jDpv3Enjh6AJFjNNJpM2kxg2",
  "name": "Bird",
  "description": "A picture of a blue and green bird flying against a backdrop of fields and clouds.",
  "path": "assets/s_01jDSh2WkN8Kp6SvRA8Ne5CJ69/bird.jpg",
  "url": "https://assets.contento.io/assets/s_01jDSh2WkN8Kp6SvRA8Ne5CJ69/bird.jpg",
  "extension": "jpg",
  "size": "1.86 MB",
  "mime_type": "image/jpeg",
  "is_image": true,
  "width": "4844",
  "height": "3234",
  "created_at": "2024-11-27T12:56:24+00:00",
  "updated_at": "2024-11-27T12:56:24+00:00"
}

/v1/assets

Returns a paginated list of assets. The asset objects are sorted in the list with the most recently added appearing first.

Request

GET https://app.contento.io/api/v1/assets HTTP/1.1
Authorization: Bearer {token}
X-CONTENTO-SITE: {site_id}

Parameters

Query parameters can be appended to the request url to filter, limit or sort the results.

In most cases you can supply either one instance of a parameter with a single value (e.g. ?folder_id=af_01Jd...), or supply multiple values using the array syntax (e.g. ?folder_id[0]=af_01Jd...&folder_id[1]=af_01JD...). If you do send multiple values then they will be executed as an AND query.

ParameterFormatsDefaultAccepted values
folder_idString or ArrayID of the asset folder you want to filter by. You can find this by clicking on the folder name in the breadcrumbs of the asset manager in Contento.
is_imageBooleanIf you set this to either true or false then you will get back either only images, or only docs accordingly.
limitInteger20The number of results you want in the response.
sortString or Arraycreated_at:descYou must supply values in the following format: attribute:direction. You can use created_at, updated_at or name followed by :asc or :desc.

Response

This will contain an array of asset objects and associated pagination data.

AttributeTypeDescription
dataArraySorted array of asset objects or an empty array if nothing can be found.
linksObjectA links pagination object.
metaObjectA meta pagination object.
{
  "data": [
    {
      "id": "a_01jDpv3Enjh6AJFjNNJpM2kxg2",
      "name": "Bird",
      "description": "A picture of a blue and green bird flying against a backdrop of fields and clouds.",
      "path": "assets/s_01jDSh2WkN8Kp6SvRA8Ne5CJ69/bird.jpg",
      "url": "https://assets.contento.io/assets/s_01jDSh2WkN8Kp6SvRA8Ne5CJ69/bird.jpg",
      "extension": "jpg",
      "size": "1.86 MB",
      "mime_type": "image/jpeg",
      "is_image": true,
      "width": "4844",
      "height": "3234",
      "created_at": "2024-11-27T12:56:24+00:00",
      "updated_at": "2024-11-27T12:56:24+00:00"
    },
    ...
  ],
  "links": {
    "first": null,
    "last": null,
    "prev": null,
    "next": "https://app.contento.io/api/v1/assets?cursor=eyJwdWJsaXNoZWRfYXQiOiIyMDIyLTA2LTA3IDExOjU0OjMwIiwiX3BvaW50c1RvTmV4dEl0ZW1zIjp0cnVlfQ"
  },
  "meta": {
    "path": "https://app.contento.io/api/v1/assets",
    "per_page": 20,
    "next_cursor": "eyJwdWJsaXNoZWRfYXQiOiIyMDIyLTA2LTA3IDExOjU0OjMwIiwiX3BvaW50c1RvTmV4dEl0ZW1zIjp0cnVlfQ",
    "prev_cursor": null
  }
}
Previous
/v1/content