Retrieve Multiple Assets
Returns an array of asset objects. This endpoint is paged.
https://mapi.storyblok.com/v1/spaces/:space_id/assets/
Path Parameters
-
:space_id
required numberNumeric ID of a space
Query Parameters
-
in_folder
numberProvide the numeric id of a folder to filter the assets by a specific folder. Use value
-1
to retrieve deleted assets. -
sort_by
stringPossible values: created_at:asc, created_at:desc, updated_at:asc, updated_at:desc, short_filename:asc, short_filename:desc
-
is_private
booleanIf "1" it only displays private assets
-
search
stringProvide a search term to filter a specific file by the filename
-
by_alt
stringFilter by the alt text of an asset
-
by_copyright
stringFilter by the copyright of an asset
-
by_title
stringFilter by the title of an asset
-
with_tag
stringFilter by specific tag(s). Multiple tags can be provided as a comma-separated string (treated like an OR operator). Examples:
with_tag=featured
with_tag=featured,editors_choice
Response Properties
-
assets
The Asset ObjectAn array of asset objects
-
id
numberThe numeric ID
-
filename
stringFull path of the asset, including the file name
-
space_id
numberSpace ID in which the asset is connected
-
created_at
stringCreation date (Format:
yyyy-MM-dd'T'HH:mm:ssZ
) -
updated_at
stringLatest update date (Format:
yyyy-MM-dd'T'HH:mm:ssZ
) -
file
objectFile Object
-
asset_folder_id
numberId of the folder containing this asset
-
deleted_at
stringDeleted date (Format: YYYY-mm-dd HH:MM)
-
short_filename
stringThe file name of the asset
-
content_type
stringThe MIME type of the asset
-
content_length
numberThe content length in bytes
-
alt
stringAlt text for the asset (default language)
-
copyright
stringCopyright text for the asset (default language)
-
title
stringTitle of the asset (default language)
-
source
stringSource text of the asset (default language)
-
expire_at
stringDate when the asset should expire (Format: yyyy-MM-dd'T'HH:mm:ssZ)
-
focus
stringThe focus point of the image (Only for image assets)
-
internal_tag_ids
string[]List of ids of the tags assigned to the asset
-
internal_tags_list
object[]List of objects containing the details of tags used for the asset
-
id
numberId of the tag
-
name
stringName of the tag
-
-
locked
booleanDefines if the asset is locked for any changes
-
publish_at
stringDate when the asset should be made public (Format: yyyy-MM-dd'T'HH:mm:ssZ)
-
is_private
booleanDefines if the asset should be inaccessable to the public
-
meta_data
objectIncludes custom metadata fields for an asset along with the default ones. It also contains the translations of the same if added in the format
metafield__i18n__langcode
. This field should be used for updating the metadata including the default ones. (alt, title, source, copyright)
-
Example Request
curl "https://mapi.storyblok.com/v1/spaces/606/assets/" \
-X GET \
-H "Authorization: YOUR_OAUTH_TOKEN" \
-H "Content-Type: application/json"
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.get('/spaces/606/assets/', {})
.then(response => {
console.log(response)
}).catch(error => {
console.log(error)
})
$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
$client->get('/spaces/606/assets/')->getBody();
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
client.false('/spaces/606/assets/')
HttpResponse<String> response = Unirest.get("https://mapi.storyblok.com/v1/spaces/606/assets/")
.header("Authorization", "YOUR_OAUTH_TOKEN")
.asString();
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/606/assets/");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
IRestResponse response = client.Execute(request);
import Foundation
let headers = [
"Content-Type": "application/json",
"Authorization": "YOUR_OAUTH_TOKEN"
]
let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/606/assets/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)
request.method = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
import requests
url = "https://mapi.storyblok.com/v1/spaces/606/assets/"
querystring = {}
payload = ""
headers = {
'Content-Type': "application/json",
'Authorization': "YOUR_OAUTH_TOKEN"
}
response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
print(response.text)
Query Examples
spaces/:space_id/assets?search="filename"
spaces/:space_id/assets?by_alt="Image alt"
spaces/:space_id/assets?by_copyright="Copyright Text"
spaces/:space_id/assets?by_title="Image title"