GraphQL
Raster provides GraphQL APIs for accessing data. A read-only public API key is available for external access to allowed libraries. This key can be:
- Initially created when needed
- Regenerated if compromised
- Deleted when no longer required
You can use this public API key to access permitted libraries outside of the Raster application through the Raster API.
Here's a curl example to get all the photos in a library:
curl --request POST \\
--header 'Content-Type: application/json' \\
--header 'Authorization: Bearer <API_KEY>' \\
--url '<https://api.raster.app/>' \\
--data '{"query": "query Photos { photos(organizationId: \\"monogram-labs\\", libraryId: \\"barcelona\\") { name url }}"}'
Make sure to replace the <API_KEY>, <ORG_ID> and the <LIBRARY_ID> with the appropriate values.
Authentication
The Raster API uses API keys to authenticate requests. You can view and manage your API keys in each organization's settings.
API access is granted through HTTP Basic Authentication. To authenticate, use your API key as the username in the basic auth process. No password is required.
You need to authenticate via bearer auth
"Authorization: Bearer pk_4eC39HqLH3U46nipzJ6ixhzdp7dc42Sf"
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
GraphQL Query Documentation
assets
Retrieves a list of assets from a specific library.
Parameters:
organizationId: ID of the organizationlibraryId: ID of the librarypage: Page number for pagination (optional)pageSize: Number of items per page (optional, default 50, maximum 500)tags: Array of tags to filter assets (optional, maximum 5 tags)
Authentication:
Requires an API key with at least 'read' access to the specified library.
Returns:
An array of asset objects.
Return Properties:
id: Unique identifier of the assetname: Name of the assetdescription: Optional text description of the assetthumbUrl: URL of the asset's thumbnail imageurl: URL to access the full size assetheight: Height of the asset in pixelswidth: Width of the asset in pixelsviews: Array of view variants or renditions of the asset, each with:id: Unique identifier of the viewparentId: Identifier of the original (parent) assetname: Name or label of the viewurl: URL to access this viewheight: Height of the view in pixelswidth: Width of the view in pixels
Notes:
- Performs an API key check and verifies library access before fetching assets.
- Throws an UNAUTHORIZED error if the API key is not authorized for the library.
Example Query:
query {
assets(
organizationId: "monogram-labs"
libraryId: "barcelona"
page: 1
pageSize: 20
tags: ["landscape", "nature"]
) {
id
name
type
url
tags
}
}
libraries
Retrieves a list of libraries for a specific organization.
Parameters:
organizationId: ID of the organizationpage: Page number for pagination (optional)pageSize: Number of items per page (optional, default 20, maximum 50)
Authentication:
Requires a valid API key.
Returns:
An array of library objects.
Return Properties:
id: Unique identifier of the libraryname: Name of the libraryassetsCount: Total number of assets contained in the librarytrashCount: Number of items currently in the library’s trashtags: Array of tags associated with the library, each containing:id: Unique identifier of the tag (string)count: Number of times the tag has been used (number)type: Type of the tag (string)
Example Query:
query {
libraries(organizationId: "monogram-labs", page: 1, pageSize: 10) {
id
name
assetsCount
trashCount
tags {
id
count
type
}
}
}
photos (DEPRECATED)
Note: 🚨 This query is deprecated. Use 'assets' instead.
Retrieves a list of photos (assets) from a specific library.
Parameters:
organizationId: ID of the organizationlibraryId: ID of the librarypage: Page number for pagination (0-based indexing) (optional)
Authentication:
Requires an API key with at least 'read' access to the specified library.
Returns:
An array of photo (asset) objects.
Return Properties:
id: Unique identifier of the photoname: Name of the photourl: URL to access the photocreatedAt: Timestamp of photo creationupdatedAt: Timestamp of last updatemetadata: Object containing additional metadata about the photo (e.g., dimensions, file size)
Notes:
- Performs an API key check and verifies library access before fetching photos.
- Throws an UNAUTHORIZED error if the API key is not authorized for the library.
- Always returns a fixed page size of 500 items.
Example Query:
query {
photos(organizationId: "monogram-labs", libraryId: "barcelona", page: 1) {
id
name
url
createdAt
updatedAt
metadata
}
}
tags
Retrieves tags associated with a specific library.
Parameters:
organizationId: ID of the organization (required)libraryId: ID of the library (required)limit: Number of top tags to retrieve (optional)
Authentication:
Requires a valid API key with access to the specified library.
Returns:
An array of tag objects, sorted by count in descending order.
Return Properties:
id: Unique identifier of the tag (string)count: Number of times the tag has been used (number)type: Type of the tag (string)
Notes:
- If
limitis provided and greater than 0, it limits the number of returned tags. - Tags are always sorted by count in descending order.
- Tags with IDs starting with '\*' will have this character removed in the response.
- If an error occurs during tag retrieval, it will be logged but not thrown.
Example Query:
query {
tags(organizationId: "monogram-labs", libraryId: "barcelona", limit: 10) {
id
count
type
}
}
This query will return the top 10 tags for the specified library, sorted by usage count.
GraphQL Mutations Documentation
uploadAssets
Uploads multiple assets (up to 20 files) to a library.
Parameters:
organizationId: ID of the organization (required)libraryId: ID of the library (required)files: Array of files to be uploaded (required, max 20 files)email: Email of the uploader (required)
Authentication: Requires an API key with 'write' access to the specified library.
Return Properties:
responseText: Text response from the upload operationassets: Array of uploaded image objects, each containing:id: Unique identifier of the uploaded assetname: Name of the assetfilename: Original filenamecontentType: MIME type of the fileworkspaceId: ID of the workspaceorganizationId: ID of the organizationcreated: Timestamp of asset creationtags: Array of tagsfile: Object containing file details (size, type, name)status: Upload statusprogress: Upload progressuploadedBy: Object containing uploader details
Notes:
- Maximum of 20 files can be uploaded in a single request
- Performs an API key check and verifies library access before uploading
- Throws an UNAUTHORIZED error if the API key is not authorized for the library
- Validates each file type and size before uploading
Example Mutation
mutation {
uploadAssets(
organizationId: "monogram-labs"
libraryId: "barcelona"
files: [$file1, $file2]
email: "user@example.com"
) {
responseText
assets {
id
name
filename
contentType
created
tags
status
progress
}
}
}
deleteAssets
Deletes multiple assets in a single operation.
Parameters:
organizationId: ID of the organization (required)libraryId: ID of the library (required)assets: Array of asset IDs to be deleted (required)
Authentication: Requires an API key with 'write' access to the specified library.
Return Properties:
success: Boolean indicating if the deletion was successfulmessage: Confirmation messageids: Array of deleted asset IDs
Notes:
- Performs an API key check and verifies library access before deleting the assets
- Throws an UNAUTHORIZED error if the API key is not authorized for the library
- Ensures all assets exist before attempting deletion
- All assets must belong to the specified library
Example Mutation:
mutation {
deleteAssets(
organizationId: "monogram-labs"
libraryId: "barcelona"
assets: ["asset-123", "asset-456"]
) {
success
message
ids
}
}