# List inference tools

GET

/v2/workspaces/{workspace\_id}/inference-tools

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

```python
import requests


url = "https://api.app.layer.ai/api/v2/workspaces/:workspace_id/inference-tools"


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/inference-tools';
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/inference-tools"


  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/inference-tools",
  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/inference-tools")
  .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/inference-tools")


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/inference-tools");
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.

List the Layer tools this caller can run in the workspace, in the order the Layer app’s tools menu shows them. Each names the base models it runs on here and the one a run takes when it names none. A tool none of whose models the workspace allows is left out.

## Authorizations

* **[bearerAuth](/docs/v2/rest-api#bearerauth)**
* **[oauth2](/docs/v2/rest-api#oauth2)**
* **[serviceAccount](/docs/v2/rest-api#serviceaccount)**  
generation: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.

### Query Parameters

**modality**

Any of:

**Modality**

_Modality_

string

Allowed values: text image audio video three\_d playable world

**null**

null

Only the tools that make this modality.

**group**

Any of:

**InferenceToolGroup**

_InferenceToolGroup_

Whether a tool makes something new or changes something the user already has.

string

Allowed values: generate edit

**null**

null

Only the tools that make something new (`generate`) or change an asset (`edit`).

**project\_id**

_Project ID_

Optional project the work would be filed in: the models and defaults answered are those a run in it gets. Without it or `session_id`, the answer is for the workspace.

string format: uuid

nullable

Optional project the work would be filed in: the models and defaults answered are those a run in it gets. Without it or `session_id`, the answer is for the workspace.

**session\_id**

_Session ID_

Optional session the work would land in: the answer is for its project. With `project_id`, the session must be in that project.

string format: uuid

nullable

Optional session the work would land in: the answer is for its project. With `project_id`, the session must be in that project.

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

_ListInferenceToolsOutput_object

**inference\_tools**

required

_Inference Tools_

Array<object>

_InferenceToolSummary_object

**key**

required

_Key_

The tool’s key, such as `image.upscale`.

string

**name**

required

_Name_

The tool’s name, as the Layer app shows it.

string

**description**

required

_Description_

What the tool does.

string

**submit\_label**

required

_Submit Label_

What the tool’s run button says in the Layer app, such as `Remove background`.

string

**progress\_label**

required

_Progress Label_

What the Layer app says while a run of the tool is in progress, such as `Removing background`.

string

**group**

required

_InferenceToolGroup_

`generate` for a tool that makes something new, `edit` for one that changes an asset.

string

Allowed values: generate edit

**modality**

required

_Modality_

The type of asset the tool makes.

string

Allowed values: text image audio video three\_d playable world

**source**

required

Any of:

**InferenceToolSource**

_InferenceToolSource_object

**modality**

required

_Modality_

The type of asset the tool works on.

string

Allowed values: text image audio video three\_d playable world

**takes\_mask**

required

_Takes Mask_

Whether the tool can keep its edit to an area a mask marks. The tool’s schema on a base model says whether that model can, in `x-source.takes_mask`.

boolean

**null**

null

**batches\_outputs**

required

_Batches Outputs_

Whether a run can make several outputs (`batch_size` above 1) where its model batches. False for a tool whose every run makes one.

boolean

**concept**

required

_Concept_

The icon the Layer app shows for the tool, by concept name, such as `upscale`. Null for a tool shown with its modality’s icon.

string

nullable

**prompt\_placeholder**

required

_Prompt Placeholder_

The hint the Layer app shows in the tool’s empty prompt; null where it shows the default.

string

nullable

**primary**

required

_Primary_

Whether the tool is an edit people reach for most on its asset type, which the Layer app offers first where a file’s edits are listed.

boolean

**keywords**

required

_Keywords_

Extra terms a search matches the tool by, such as synonyms and the names the community uses.

Array<string>

**base\_model\_ids**

required

_Base Model IDs_

The base models the caller can run the tool on, in catalog order.

Array<string>

**default\_base\_model\_id**

required

_Default Base Model ID_

The model a run of the tool takes when it names none: the tool’s own default, else the caller’s first pinned model among `base_model_ids`, else Layer’s recommendation for the tool’s job.

string

**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
{
  "inference_tools": [
    {
      "group": "generate",
      "modality": "text",
      "source": {
        "modality": "text"
      }
    }
  ]
}
```

### 401

Unauthenticated — missing or invalid Bearer token.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

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

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

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

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

### 404

Resource not found.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

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

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

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

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

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

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

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

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

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

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

### 500

Internal server error.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

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