Skip to content

Delete thread

Deprecated
ThreadDeleted beta().threads().delete(ThreadDeleteParamsparams = ThreadDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
DELETE/threads/{thread_id}

Delete a thread.

ParametersExpand Collapse
ThreadDeleteParams params
Optional<String> threadId
ReturnsExpand Collapse
class ThreadDeleted:
String id
boolean deleted
JsonValue; object_ "thread.deleted"constant"thread.deleted"constant

Delete thread

package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.beta.threads.ThreadDeleteParams;
import com.openai.models.beta.threads.ThreadDeleted;

public final class Main {
    private Main() {}

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

        ThreadDeleted threadDeleted = client.beta().threads().delete("thread_id");
    }
}
{
  "id": "id",
  "deleted": true,
  "object": "thread.deleted"
}
Returns Examples
{
  "id": "id",
  "deleted": true,
  "object": "thread.deleted"
}