# List session objects

GET

/v2/workspaces/{workspace\_id}/sessions/{session\_id}/objects

```bash
curl --request GET \
  --url https://api.app.layer.ai/api/v2/workspaces/:workspace_id/sessions/:session_id/objects \
  --header 'Authorization: Bearer <token>'
```

```python
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())
```

```js
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);
}
```

```go
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
<?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;
}
```

```java
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();
```

```ruby
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_body
```

```csharp
var 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);
```

* Layer API

> **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

* **[bearerAuth](/docs/v2/rest-api#bearerauth)**
* **[oauth2](/docs/v2/rest-api#oauth2)**
* **[serviceAccount](/docs/v2/rest-api#serviceaccount)**  
sessions:read

## Parameters

### Path Parameters

**workspace\_id**

required

_Workspace Id_

Id of the workspace that owns the resource.

string format: uuid

Id of the workspace that owns the resource.

**session\_id**

required

_Session Id_

Id of the session.

string format: uuid

Id of the session.

### Query Parameters

**limit**

_Limit_

Maximum number of results to return.

integer

default: 20 \>= 1 <= 100

Maximum number of results to return.

**cursor**

_Cursor_

Cursor from a previous response to fetch the next page.

string

nullable

Cursor from a previous response to fetch the next page.

## Responses

### 200

Successful Response

_ListSessionObjectsOutput_object

**objects**

required

_Objects_

Array<object>

_SessionObject_

A file or asset in the session, as it stands now: what a `SessionEvent` carries.

object

**kind**

required

_Kind_

Whether the object is a single file or a composite asset.

string

Allowed values: file asset

**name**

required

_Name_

The object’s display name.

string

**content\_type**

_Content Type_

MIME type, for a file.

string

nullable

**status**

_Status_

Processing status, for a file. A file is ready to download once it reads `processed`.

string

nullable

**url**

_Url_

Download URL, for a processed file.

string

nullable

**preview\_url**

_Preview Url_

Thumbnail URL, for a file that has one.

string

nullable

**width**

_Width_

Width in pixels, for an image or video file.

integer

nullable

**height**

_Height_

Height in pixels, for an image or video file.

integer

nullable

**metadata**

Any of:

**FileMetadataView**

_FileMetadataView_

What an engine needs beyond the image to build a resource from a file. Each kind is null when absent.

object

**tile**

Any of:

**null**

_TileMetadataView_

Where a game tile’s sprite sits on its grid, in the sprite’s own pixels from its top-left corner.

object

**shape**

required

_TileShape_

The outline of one grid cell seen from straight above.

string

Allowed values: SQUARE HEXAGON

**orientation**

required

_TileOrientation_

How the cell is turned to the camera: DIAMOND or ALIGNED for a square, POINTY\_TOP or FLAT\_TOP for a hexagon.

string

Allowed values: DIAMOND ALIGNED POINTY\_TOP FLAT\_TOP

**elevation**

required

_Elevation_

Camera tilt in degrees above the ground plane; 90 is straight down.

number

**facing**

required

_Facing_

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.

integer

**footprint\_width**

required

_Footprint Width_

Cells the footprint covers across (the base’s right-hand edge) at facing 0.

integer

**footprint\_depth**

required

_Footprint Depth_

Cells the footprint covers deep (the base’s left-hand edge) at facing 0.

integer

**height**

required

_Height_

Wall height in cell sides: 0 is a flat ground tile, 1 a cube on a square.

number

**tile\_width**

required

_Tile Width_

Width in pixels of one cell’s base outline in the sprite.

integer

**tile\_height**

required

_Tile Height_

Height in pixels of one cell’s base outline in the sprite.

integer

**anchor**

required

_TilePointView_

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

**x**

required

_X_

Pixels right of the sprite’s left edge.

number

**y**

required

_Y_

Pixels down from the sprite’s top edge.

number

**cell\_center**

required

_TilePointView_

The centre of the anchor’s cell. Godot and Unity pin a tile here rather than at the anchor.

object

**x**

required

_X_

Pixels right of the sprite’s left edge.

number

**y**

required

_Y_

Pixels down from the sprite’s top edge.

number

**base\_outline**

required

_Base Outline_

The footprint’s whole base outline, clockwise on screen from the anchor’s vertex or edge.

Array<object>

_TilePointView_object

**x**

required

_X_

Pixels right of the sprite’s left edge.

number

**y**

required

_Y_

Pixels down from the sprite’s top edge.

number

**subject\_id**

_Subject Id_

What the tile shows. Every facing of one subject shares it, so a tileset can group them.

string format: uuid

nullable

**TileMetadataView**

null

**nine\_slice**

Any of:

**null**

_NineSliceMetadataView_

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

**left**

required

_Left_

Pixels in from the left edge.

integer

**top**

required

_Top_

Pixels in from the top edge.

integer

**right**

required

_Right_

Pixels in from the right edge.

integer

**bottom**

required

_Bottom_

Pixels in from the bottom edge.

integer

**source**

required

_NineSliceSource_

DETECTED when measured off the pixels, USER when a person set the insets.

string

Allowed values: DETECTED USER

**NineSliceMetadataView**

null

**sprite\_sheet**

Any of:

**null**

_SpriteSheetMetadataView_

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

**columns**

required

_Columns_

Cells across.

integer

**rows**

required

_Rows_

Cells down.

integer

**cell\_width**

required

_Cell Width_

Width of one cell in pixels.

integer

**cell\_height**

required

_Cell Height_

Height of one cell in pixels.

integer

**margin**

required

_Margin_

Pixels between the sheet’s edges and the outer cells.

integer

**spacing**

required

_Spacing_

Pixels between neighbouring cells.

integer

**frames**

required

_Frames_

The frames, in play order: left to right, then top to bottom, unless the list orders them otherwise.

Array<object>

_SpriteSheetFrameView_

One frame’s rect on the sheet, in the sheet’s own pixels from its top-left corner.

object

**index**

required

_Index_

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.

integer

**x**

required

_X_

The frame’s left edge on the sheet, in pixels.

integer

**y**

required

_Y_

The frame’s top edge on the sheet, in pixels.

integer

**w**

required

_W_

The frame’s width in pixels.

integer

**h**

required

_H_

The frame’s height in pixels.

integer

**anchor**

Any of:

**SpriteSheetMetadataView**

_TilePointView_object

**x**

required

_X_

Pixels right of the sprite’s left edge.

number

**y**

required

_Y_

Pixels down from the sprite’s top edge.

number

**null**

null

**animations**

required

_Animations_

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.

Array<object>

_SpriteSheetAnimationView_object

**name**

required

_Name_

The animation’s name.

string

**frames**

required

_Frames_

Frame indexes (`frames[].index`), in play order.

Array<integer>

**fps**

required

_Fps_

Frames per second.

number

**loop**

required

_Loop_

Whether the animation restarts after its last frame.

boolean

**TilePointView**

null

**null**

null

**object\_id**

required

_Object Id_

The object’s id, the same one its `SessionEvent`s carry. For a file this is its file\_id.

string format: uuid

**pagination**

required

_PaginationOutput_object

**next\_cursor**

_Next Cursor_

Cursor to use to get the next page

string

nullable

**has\_more\_results**

required

_Has More Results_

If there are more results to page through

boolean

**total\_count**

_Total Count_

Total number of results matching the query

integer

nullable

##### Example

```json
{
  "objects": [
    {
      "kind": "file",
      "metadata": {
        "tile": {
          "shape": "SQUARE",
          "orientation": "DIAMOND"
        },
        "nine_slice": {
          "source": "DETECTED"
        }
      }
    }
  ]
}
```

### 401

Unauthenticated — missing or invalid Bearer token.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 403

Forbidden — insufficient permissions, or the access token lacks the scope the operation requires.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 404

Resource not found.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 409

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

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 422

Invalid input parameters, or an `Idempotency-Key` reused for a different request.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 429

Rate limited — retry after the number of seconds in `Retry-After`.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 500

Internal server error.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```
