Assets

Getting a list of assets

Endpoint

GET /v1/spaces/:space_id/assets

Request

cURL

curl "https://api.storyblok.com/v1/spaces/158/assets" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMjcsInRpbWVzdGFtcCI6MTUyMzk2MzQzN30.4ndEPEDh0-wSivh-isBjKRLukXkAlJ02kIn89fZJPhA" \

Response

Body

{
  "assets": [

  ]
}

Get a single asset

Endpoint

GET /v1/spaces/:space_id/assets/:id

Request

cURL

curl "https://api.storyblok.com/v1/spaces/157/assets/7" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMjYsInRpbWVzdGFtcCI6MTUyMzk2MzQzN30.gvckoP_xP4ZkIjPUNYlBe5NcBZXkCJN9UlBWBoXvA0Q" \

Response

Body

{
  "id": 7,
  "filename": "quibusdam-ad",
  "space_id": 157,
  "created_at": "2018-04-10T11:10:37.408Z",
  "updated_at": "2018-04-10T11:10:37.408Z",
  "file": {
    "url": null
  },
  "asset_folder_id": null,
  "deleted_at": null
}

Sign asset

Uploading assets in Storyblok is a two step process. First you need to sign the asset you want to upload. Then you need to post the image as form data to our Amazon S3 bucket.

Here you can find an example using Node.js:
https://github.com/onefriendaday/storyblok-file-upload-example

Endpoint

POST /v1/spaces/:space_id/assets

Parameters

Name Description
filename required Filename
asset_folder_id Asset folder id

Request

cURL

curl "https://api.storyblok.com/v1/spaces/155/assets" -d '{"filename":"test 2%2231.jpg"}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMjQsInRpbWVzdGFtcCI6MTUyMzk2MzQzN30._RDvUo64GFinH7WjgLcjuDwPASq4MXg-chzfhZ7G_HQ" \

Response

Body

{
  "pretty_url": "//a.storyblok.com/f/155/00e419d0d0/test-2-2231.jpg",
  "public_url": "https://s3.amazonaws.com/a.storyblok.com/f/155/00e419d0d0/test-2-2231.jpg",
  "fields": {
    "key": "f/155/00e419d0d0/test-2-2231.jpg",
    "acl": "public-read",
    "Expires": "Wed, 10 Apr 2019 11:10:37 GMT",
    "Cache-Control": "public; max-age=31536000",
    "Content-Type": "image/jpeg",
    "policy": "eyJleHBpcmF0aW9uIjoiMjAxOC0wNC0xMFQxMToyMDozN1oiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJhLnN0b3J5Ymxvay5jb20ifSx7ImtleSI6ImYvMTU1LzAwZTQxOWQwZDAvdGVzdC0yLTIyMzEuanBnIn0seyJhY2wiOiJwdWJsaWMtcmVhZCJ9LHsiRXhwaXJlcyI6IldlZCwgMTAgQXByIDIwMTkgMTE6MTA6MzcgR01UIn0seyJDYWNoZS1Db250cm9sIjoicHVibGljOyBtYXgtYWdlPTMxNTM2MDAwIn0seyJDb250ZW50LVR5cGUiOiJpbWFnZS9qcGVnIn0sWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMSw3ODY0MzE5OV0seyJ4LWFtei1jcmVkZW50aWFsIjoiQUtJQUlVNjI3RU5VUVQ0UlcyM0EvMjAxODA0MTAvdXMtZWFzdC0xL3MzL2F3czRfcmVxdWVzdCJ9LHsieC1hbXotYWxnb3JpdGhtIjoiQVdTNC1ITUFDLVNIQTI1NiJ9LHsieC1hbXotZGF0ZSI6IjIwMTgwNDEwVDExMTAzN1oifV19",
    "x-amz-credential": "AKIAIU627ENUQT4RW23A/20180410/us-east-1/s3/aws4_request",
    "x-amz-algorithm": "AWS4-HMAC-SHA256",
    "x-amz-date": "20180410T111037Z",
    "x-amz-signature": "5d0311fbde9573c5860cf0cc2b521ad2683318ffa44df7ee0d6ae1c97f32c5eb"
  },
  "post_url": "https://s3.amazonaws.com/a.storyblok.com"
}

Documentation