List session objects
Viewing v2— current version
curl --request GET \ --url https://api.app.layer.ai/api/v2/workspaces/:workspace_id/sessions/:session_id/objects \ --header 'Authorization: Bearer <token>'import requests
url = "https://api.app.layer.ai/api/v2/workspaces/:workspace_id/sessions/:session_id/objects"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.json())const url = 'https://api.app.layer.ai/api/v2/workspaces/:workspace_id/sessions/:session_id/objects';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}package main
import ( "fmt" "net/http" "io")
func main() {
url := "https://api.app.layer.ai/api/v2/workspaces/:workspace_id/sessions/:session_id/objects"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://api.app.layer.ai/api/v2/workspaces/:workspace_id/sessions/:session_id/objects", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "Authorization: Bearer <token>" ],]);
$response = curl_exec($curl);$err = curl_error($curl);
curl_close($curl);
if ($err) { echo "cURL Error #:" . $err;} else { echo $response;}OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder() .url("https://api.app.layer.ai/api/v2/workspaces/:workspace_id/sessions/:session_id/objects") .get() .addHeader("Authorization", "Bearer <token>") .build();
Response response = client.newCall(request).execute();require 'uri'require 'net/http'
url = URI("https://api.app.layer.ai/api/v2/workspaces/:workspace_id/sessions/:session_id/objects")
http = Net::HTTP.new(url.host, url.port)http.use_ssl = true
request = Net::HTTP::Get.new(url)request["Authorization"] = 'Bearer <token>'
response = http.request(request)puts response.read_bodyvar client = new RestClient("https://api.app.layer.ai/api/v2/workspaces/:workspace_id/sessions/:session_id/objects");var request = new RestRequest("", Method.Get);request.AddHeader("Authorization", "Bearer <token>");var response = client.Execute(request);New in v2. This endpoint has no v1 equivalent.
The files and assets in the session, newest first, each as a SessionEvent describes it. To keep a view of the session current, open the event stream first and read this once it has connected: nothing is missed between the two, and a change may appear in both.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Id of the workspace that owns the resource.
Id of the workspace that owns the resource.
Id of the session.
Id of the session.
Query Parameters
Section titled “Query Parameters”Maximum number of results to return.
Maximum number of results to return.
Cursor from a previous response to fetch the next page.
Cursor from a previous response to fetch the next page.
Responses
Section titled “Responses”Successful Response
object
A file or asset in the session, as it stands now: what a SessionEvent carries.
object
Whether the object is a single file or a composite asset.
The object’s display name.
MIME type, for a file.
Processing status, for a file. A file is ready to download once it reads processed.
Download URL, for a processed file.
Thumbnail URL, for a file that has one.
Width in pixels, for an image or video file.
Height in pixels, for an image or video file.
What an engine needs beyond the image to build a resource from a file. Each kind is null when absent.
object
Where a game tile’s sprite sits on its grid, in the sprite’s own pixels from its top-left corner.
object
The outline of one grid cell seen from straight above.
How the cell is turned to the camera: DIAMOND or ALIGNED for a square, POINTY_TOP or FLAT_TOP for a hexagon.
Camera tilt in degrees above the ground plane; 90 is straight down.
Quarter turn of the camera around the tile, in degrees clockwise seen from above: 0, 90, 180, or 270. A hexagon is only drawn facing 0.
Cells the footprint covers across (the base’s right-hand edge) at facing 0.
Cells the footprint covers deep (the base’s left-hand edge) at facing 0.
Wall height in cell sides: 0 is a flat ground tile, 1 a cube on a square.
Width in pixels of one cell’s base outline in the sprite.
Height in pixels of one cell’s base outline in the sprite.
The point the tile is placed by: the bottom centre of the cell it stands on (the front cell of a footprint wider than one).
object
Pixels right of the sprite’s left edge.
Pixels down from the sprite’s top edge.
The centre of the anchor’s cell. Godot and Unity pin a tile here rather than at the anchor.
object
Pixels right of the sprite’s left edge.
Pixels down from the sprite’s top edge.
The footprint’s whole base outline, clockwise on screen from the anchor’s vertex or edge.
object
Pixels right of the sprite’s left edge.
Pixels down from the sprite’s top edge.
What the tile shows. Every facing of one subject shares it, so a tileset can group them.
The insets a 9-slice draws a UI element by, in the image’s own pixels in from each edge.
The corners are drawn at their own size, the edges stretch along their length, and the centre stretches both ways.
object
Pixels in from the left edge.
Pixels in from the top edge.
Pixels in from the right edge.
Pixels in from the bottom edge.
DETECTED when measured off the pixels, USER when a person set the insets.
The frame grid a sprite sheet was packed on, in the sheet’s own pixels from its top-left corner.
Cells start margin pixels in from the sheet’s edges with spacing pixels between them.
object
Cells across.
Cells down.
Width of one cell in pixels.
Height of one cell in pixels.
Pixels between the sheet’s edges and the outer cells.
Pixels between neighbouring cells.
The frames, in play order: left to right, then top to bottom, unless the list orders them otherwise.
One frame’s rect on the sheet, in the sheet’s own pixels from its top-left corner.
object
The frame’s cell in reading order over the whole grid (left to right, then top to bottom). Cells that hold no frame are left out, so indexes can skip.
The frame’s left edge on the sheet, in pixels.
The frame’s top edge on the sheet, in pixels.
The frame’s width in pixels.
The frame’s height in pixels.
object
Pixels right of the sprite’s left edge.
Pixels down from the sprite’s top edge.
Named animations over the frames. When empty, play the sheet as one animation named default over every frame in frames order, at 12 fps, looping.
object
The animation’s name.
Frame indexes (frames[].index), in play order.
Frames per second.
Whether the animation restarts after its last frame.
The object’s id, the same one its SessionEvents carry. For a file this is its file_id.
object
Cursor to use to get the next page
If there are more results to page through
Total number of results matching the query
Example
{ "objects": [ { "kind": "file", "metadata": { "tile": { "shape": "SQUARE", "orientation": "DIAMOND" }, "nine_slice": { "source": "DETECTED" } } } ]}Unauthenticated — missing or invalid Bearer token.
object
Example
{ "type": "https://api.layer.ai/errors/ERROR_CODE", "title": "Error Title", "status": 400, "detail": "Human-readable description."}Forbidden — insufficient permissions, or the access token lacks the scope the operation requires.
object
Example
{ "type": "https://api.layer.ai/errors/ERROR_CODE", "title": "Error Title", "status": 400, "detail": "Human-readable description."}Resource not found.
object
Example
{ "type": "https://api.layer.ai/errors/ERROR_CODE", "title": "Error Title", "status": 400, "detail": "Human-readable description."}The outcome of the request with this Idempotency-Key is not known yet: it is still running, or it failed without a stored response. Retry after the number of seconds in Retry-After.
object
Example
{ "type": "https://api.layer.ai/errors/ERROR_CODE", "title": "Error Title", "status": 400, "detail": "Human-readable description."}Invalid input parameters, or an Idempotency-Key reused for a different request.
object
Example
{ "type": "https://api.layer.ai/errors/ERROR_CODE", "title": "Error Title", "status": 400, "detail": "Human-readable description."}Rate limited — retry after the number of seconds in Retry-After.
object
Example
{ "type": "https://api.layer.ai/errors/ERROR_CODE", "title": "Error Title", "status": 400, "detail": "Human-readable description."}Internal server error.
object
Example
{ "type": "https://api.layer.ai/errors/ERROR_CODE", "title": "Error Title", "status": 400, "detail": "Human-readable description."}