Conversations endpoint
The Conversations endpoint lets you create a Converse conversation. In a conversation, you can use prompts to get on-demand information from documents of nearly any type or format.
- curl examples reference the
API_ROOT
,API_TOKEN
, andIB_CONTEXT
values as variables. If you don’t set up these variables, define them in the request. - For Python request examples, it’s assumed you installed the AI Hub SDK. All examples also include lines initializing the API client, with values you must define.
- All endpoints support the IB-Context header. Organization members must set the
IB-Context
header as their organization ID to complete the request with their organization account. While optional, it’s a best practice to include theIB-Context
header in all requests. - All endpoints use the standard HTTP response status codes. For each endpoint, some common status codes are listed.
Create conversation
Description
Create a new conversation by making a POST
request to API_ROOT/v2/conversations
. You can upload files to the conversation in the same request.
There are some limitations when uploading files to a conversation:
- Files can be up to 50 MB or 800 pages.
- You can upload up to 100 MB per request.
- You can have up to 100 documents per conversation.
- There are specific supported file types.
Request body
Parameters are required unless marked as optional.
Response status
Response schema
Examples
Request (curl)
Request (Python SDK)
Response
List conversations
Description
Return a list of conversations you’ve created by sending a GET
request to API_ROOT/v2/conversations
.
Query parameters
Request body
There is no request body. Use query parameters to filter your results, if needed.
Response status
Response schema
Examples
Request (curl)
Request (Python SDK)
Response
Conversation information
Description
Retrieve information about a conversation, such as its state and a list of documents in the conversation, by making a GET
request to API_ROOT/v2/conversations/<CONVERSATION-ID>
.
Request body
There is no request body. Use the request URL to provide the conversation ID.
Response status
Response schema
Examples
Request (curl)
Request (Python SDK)
Response
Converse with a document
Description
Query a document in your conversation by making a POST
request to API_ROOT/v2/conversations/<CONVERSATION-ID>/prompts
.
Request body
Parameters are required unless marked as optional.
Response status
Response schema
Examples
Request (curl)
Request (Python SDK)
Response
Add documents to conversation
Description
Upload documents to a conversation by making a POST
request to API_ROOT/v2/conversations/<CONVERSATION-ID>/documents
.
There are some limitations when uploading files to a conversation:
- Files can be up to 50 MB or 800 pages.
- You can upload up to 100 MB per request.
- You can have up to 100 documents per conversation.
- There are specific supported file types
Request body
Parameters are required unless marked as optional.
Response status
Response schema
Examples
Request (curl)
Request (Python SDK)
Response
Delete documents from conversation
Description
Delete documents from a conversation by making a DELETE
request to API_ROOT/v2/conversations/<CONVERSATION-ID>/documents
.
Request body
Parameters are required unless marked as optional.
Response status
Response schema
No content is returned for successful requests.
Examples
Request (curl)
Request (Python SDK)
Get document metadata
Description
Retrieve metadata for a document in a conversation by making a GET
request to API_ROOT/v2/conversations/<CONVERSATION-ID>/documents/<DOCUMENT-ID>
.
Request body
There is no request body. Use the request URL to specify the conversation and document.
Response status
Response schema
Examples
Request (curl)
Request (Python SDK)
Response
Update conversation information
Description
Update a conversation name or description by making a PUT
request to API_ROOT/v2/conversations/<CONVERSATION-ID>
. The new values are passed using query parameters, such as API_ROOT/v2/conversations/<CONVERSATION-ID>?name=<CONVERSATION-NAME>&description=<CONVERSATION-DESCRIPTION>
.
Query parameters
Response status
Response schema
No content is returned for successful requests. In case of an internal server error, an error message is provided in the response body.