Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge
microsoft-foundry.rest.security.o-auth2-auth

Assistants

List assistants

GET /openai/v1/assistants Deprecated

Lists assistants matching the request filters.

Query parameters

limit integer Deprecated

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

order enum Deprecated

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

ascdesc
after string Deprecated

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

before string Deprecated

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

Responses

The request has succeeded.

Body

Content-Type: application/json
object string required Deprecated
data OpenAI.AssistantObject[] required Deprecated
first_id string required Deprecated
last_id string required Deprecated
has_more boolean required Deprecated

Client error

Body

Content-Type: application/json
error OpenAI.Error required Deprecated
code string | null required Deprecated
message string required Deprecated
param string | null Deprecated
type string Deprecated
misalignment OpenAI.MisalignmentErrorDetailsResource Deprecated
review_target string | null Deprecated
error_type string | enum Deprecated
Any of the following:
string Deprecated
enum Deprecated
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string Deprecated

The public explanation for this block.

steer OpenAI._MisalignmentSteer Deprecated
message string required Deprecated

The public continuation instruction.

details OpenAI.Error[] Deprecated
additionalInfo object Deprecated
debugInfo object Deprecated

Server error

Body

Content-Type: application/json
error OpenAI.Error required Deprecated
code string | null required Deprecated
message string required Deprecated
param string | null Deprecated
type string Deprecated
misalignment OpenAI.MisalignmentErrorDetailsResource Deprecated
review_target string | null Deprecated
error_type string | enum Deprecated
Any of the following:
string Deprecated
enum Deprecated
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string Deprecated

The public explanation for this block.

steer OpenAI._MisalignmentSteer Deprecated
message string required Deprecated

The public continuation instruction.

details OpenAI.Error[] Deprecated
additionalInfo object Deprecated
debugInfo object Deprecated

Request

curl "https://api.openai.com/v1/assistants?order=desc&limit=20" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2"
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
page = client.beta.assistants.list()
page = page.data[0]
print(page.id)
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const myAssistants = await openai.beta.assistants.list({
    order: "desc",
    limit: "20",
  });

  console.log(myAssistants.data);
}

main();
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const assistant of client.beta.assistants.list()) {
  console.log(assistant.id);
}
package main

import (
    "context"
    "fmt"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    page, err := client.Beta.Assistants.List(context.TODO(), openai.BetaAssistantListParams{})
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", page)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.beta.assistants.AssistantListPage;
import com.openai.models.beta.assistants.AssistantListParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        AssistantListPage page = client.beta().assistants().list();
    }
}
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

page = openai.beta.assistants.list

puts(page)

Response

{
  "object": "list",
  "data": [
    {
      "id": "asst_abc123",
      "object": "assistant",
      "created_at": 1698982736,
      "name": "Coding Tutor",
      "description": null,
      "model": "gpt-4o",
      "instructions": "You are a helpful assistant designed to make me better at coding!",
      "tools": [],
      "tool_resources": {},
      "metadata": {},
      "top_p": 1.0,
      "temperature": 1.0,
      "response_format": "auto"
    },
    {
      "id": "asst_abc456",
      "object": "assistant",
      "created_at": 1698982718,
      "name": "My Assistant",
      "description": null,
      "model": "gpt-4o",
      "instructions": "You are a helpful assistant designed to make me better at coding!",
      "tools": [],
      "tool_resources": {},
      "metadata": {},
      "top_p": 1.0,
      "temperature": 1.0,
      "response_format": "auto"
    },
    {
      "id": "asst_abc789",
      "object": "assistant",
      "created_at": 1698982643,
      "name": null,
      "description": null,
      "model": "gpt-4o",
      "instructions": null,
      "tools": [],
      "tool_resources": {},
      "metadata": {},
      "top_p": 1.0,
      "temperature": 1.0,
      "response_format": "auto"
    }
  ],
  "first_id": "asst_abc123",
  "last_id": "asst_abc789",
  "has_more": false
}
en-us
Your Privacy Choices
  • AI Disclaimer
  • Previous Versions
  • Blog
  • Contribute
  • Privacy
  • Consumer Health Privacy
  • Terms of Use
  • Trademarks
  • © Microsoft 2026