Ir al contenido principal

Este explorador ya no se admite.

Actualice a Microsoft Edge para aprovechar las características y actualizaciones de seguridad más recientes, y disponer de soporte técnico.

Descargar Microsoft Edge Más información sobre Internet Explorer y Microsoft Edge
microsoft-foundry.rest.security.o-auth2-auth

Conversations

Retrieve a conversation

GET /openai/v1/conversations/{conversation_id}

Retrieves the specified conversation and its metadata.

Parámetros de la ruta de acceso

conversation_id string requerido

The id of the conversation to retrieve.

Parámetros de encabezado

x-ms-user-identity string

Opaque per-user identity string used to scope endpoint-scoped data to a specific end user. The caller must have the agents/endpoints/UserIdentityImpersonation/action RBAC permission.

Respuestas

The request has succeeded.

Cuerpo

Content-Type: application/json
id string requerido

The unique ID of the conversation.

object enum requerido

The object type, which is always conversation.

conversation
metadata OpenAI.Metadata requerido

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

[key: string] string
created_at integer requerido

The time at which the conversation was created, measured in seconds since the Unix epoch.

Client error

Cuerpo

Content-Type: application/json
error OpenAI.Error requerido
code string | null requerido
message string requerido
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Cualquiera de las siguientes:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string requerido

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Cuerpo

Content-Type: application/json
error OpenAI.Error requerido
code string | null requerido
message string requerido
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Cualquiera de las siguientes:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string requerido

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Solicitar

curl https://api.openai.com/v1/conversations/conv_123 \
  -H "Authorization: Bearer $OPENAI_API_KEY"
import OpenAI from "openai";
const client = new OpenAI();

const conversation = await client.conversations.retrieve("conv_123");
console.log(conversation);
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
conversation = client.conversations.retrieve(
    "conv_123",
)
print(conversation.id)
using System;
using OpenAI.Conversations;

OpenAIConversationClient client = new(
    apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY")
);

Conversation conversation = client.GetConversation("conv_123");
Console.WriteLine(conversation.Id);
import OpenAI from 'openai';

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

const conversation = await client.conversations.retrieve('conv_123');

console.log(conversation.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"),
    )
    conversation, err := client.Conversations.Get(context.TODO(), "conv_123")
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", conversation.ID)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.conversations.Conversation;
import com.openai.models.conversations.ConversationRetrieveParams;

public final class Main {
    private Main() {}

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

        Conversation conversation = client.conversations().retrieve("conv_123");
    }
}
require "openai"

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

conversation = openai.conversations.retrieve("conv_123")

puts(conversation)

Respuesta

{
  "id": "conv_123",
  "object": "conversation",
  "created_at": 1741900000,
  "metadata": {"topic": "demo"}
}
es-es
Sus opciones de privacidad
  • Declinación de responsabilidades de IA
  • Versiones anteriores
  • Blog
  • Contribuir
  • Privacidad
  • Privacidad de estado del consumidor
  • Términos de uso
  • Marcas comerciales
  • © Microsoft 2026