I can get a list of assistants from PostMan, but if I try to get a list of threads it says I need to set a session key. I’ve tried asking a gpt I that’s RAGged on the docs, but it seems stumped too:
To set a session key in Postman, you would typically use it in the same way you set an API key, either as a header or as a cookie. Since the OpenAI API is indicating that a session key is needed, this is how you might typically set it up in Postman:
-
As a Header: If the session key is expected to be passed as a header, you would add a new key-value pair under the Headers tab of your Postman request. The key might be something like
Authorization
(if different from the Bearer token) or a custom header name as specified by the API documentation, and the value would be the session key you have. -
As a Cookie: If the session key is expected to be passed as a cookie, you would go to the Cookies section right next to the Headers tab in Postman and add the session key there.
However, in server-to-server communications, which is what Postman is typically used for, session keys are not commonly used. Session keys are more often associated with user sessions within a web application. Therefore, it’s unusual for an API to require a session key for server-to-server requests.
In the specific case of the OpenAI API, the documentation and the error message you received suggest that the session key is required for the threads endpoint, which is not standard for API requests made from tools like Postman. It might be a special case that OpenAI has implemented for this particular endpoint.
Here’s what you can try:
-
If you have a web application that interacts with the OpenAI API, and you have a session key from a user’s session, you can try using that in Postman just for testing purposes. This is not a long-term solution because session keys are generally short-lived and tied to a user session.
-
For a proper and sustainable integration, refer to the OpenAI API documentation for the threads endpoint to understand the expected authentication mechanism. If the documentation is not clear or does not specify the use of session keys, reach out to OpenAI support for assistance.
Without explicit instructions from the API documentation or OpenAI support, setting a session key in Postman for the OpenAI API is not a standard procedure, and I would advise against trying to use session keys in this context unless specifically guided by OpenAI.