Queries
Read assets, libraries, and tags from your Raster organization.
Queries read data from Raster. Every query requires an API key with at least
Read access to the libraries it touches, and is sent as a POST request to
https://api.raster.app/.
assets
Retrieves a paginated list of assets from a library.
Parameters
Prop
Type
Returns
An array of Asset objects.
Example
query {
assets(
organizationId: "acme-co"
libraryId: "barcelona"
page: 1
pageSize: 20
tags: ["landscape", "nature"]
) {
id
name
type
url
tags
}
}The request verifies your API key and library access before fetching. If the key
is not authorized for the library, the query fails with an
API_KEY_NOT_AUTHORIZED_FOR_LIBRARY error.
asset
Retrieves a single Asset by id from a library. Use it to
read one asset's metadata when you already hold its id.
Parameters
Prop
Type
Returns
A single Asset. A missing asset, an asset in a different
library, and a trashed asset all fail with the same 404 (RESOURCE_NOT_FOUND).
Example
query {
asset(organizationId: "acme-co", libraryId: "barcelona", assetId: "asset-123") {
id
name
url
tags
description
}
}searchAssets
Searches assets across the libraries your API key authorizes, returning
relevance-ranked hits with optional highlighted snippets. Scoped to one
organization; the libraries parameter selects which authorized libraries to
search.
Parameters
Prop
Type
Returns
A SearchResult — see also SearchHit.
Example
query {
searchAssets(
organizationId: "acme-co"
q: "sunset"
libraries: ["barcelona", "lisbon"]
page: 1
pageSize: 10
) {
hits {
id
name
url
libraryId
score
highlights {
name
tags
}
}
found
page
}
}libraries
Retrieves a paginated list of libraries in an organization.
Parameters
Prop
Type
Returns
An array of Library objects.
Example
query {
libraries(organizationId: "acme-co", page: 1, pageSize: 10) {
id
name
assetsCount
trashCount
tags {
id
count
type
}
}
}tags
Retrieves the tags used in a library, sorted by usage count (descending).
Parameters
Prop
Type
Returns
An array of Tag objects.
Example
query {
tags(organizationId: "acme-co", libraryId: "barcelona", limit: 10) {
id
count
type
}
}viewer
Resolves the organization and libraries your API key can act on. Use it first
when you hold only a key and need the organizationId (and authorized library
ids) for every other query and mutation.
Parameters
None.
Returns
Prop
Type
Example
query {
viewer {
organizationId
organizationName
plan
libraries {
library
access
}
}
}photos (deprecated)
Deprecated. Use assets instead. photos is kept only for
backward compatibility and may be removed in a future release.
Retrieves a list of assets from a library, with a fixed page size of 500 items.
Parameters
Prop
Type
Returns
An array of photo objects with id, name, url, createdAt, updatedAt,
and a metadata object.
Example
query {
photos(organizationId: "acme-co", libraryId: "barcelona", page: 0) {
id
name
url
createdAt
updatedAt
metadata
}
}