Unable to Retrieve Full Historic Responses via OpenAI Responses API

I’m currently integrating with the OpenAI Responses API to retrieve the full context of a conversation for analysis and storage. I’m using the following endpoint:

/v1/responses/{response_id}/input_items

When calling this endpoint with the latest response_id from a conversation, the object returned does not include the most recent text response generated by the model. Instead, it appears to contain only the historical context up to the last input, excluding the final output.

How can I programmatically retrieve the full historic conversation, with all input-output pairs (not just inputs), including the latest model response?

1 Like

If I’m not wrong you can take the latest response object and read the property “previous_response_id” and make a loop to retrieve the whole conversation until you get to the top (where it will return null).

I suppose it is the same thing the API does internally when you inform the previous_response_id to follow an existing conversation. It doesn’t have an object for conversation, just the link for the previous element.

In complement to that, it seems you can also call the list items API to retrieve the remaining inputs related to that particular conversation.