Use the API

Authentication

Get your API key on your My Account page and use it to authorize your requests.

Your API key provides access to your connected data sources via Chat Ur Data. Be careful with it.

Interacting with Chat Ur Data via API

To chat via API, you'll need to use a combination of two endpoints:

  1. a POST to create a thread or add a message to a thread

  2. a GET to retrieve the messages in the thread

Start a New Thread

To start a new thread you'll post a message with no thread_id to the new chat endpoint. The response will include a thread_id that you can poll on for updates to the thread, as well as a run status so you know if it's finished yet.

Get the Messages in your Thread

To get the messages in a thread you need to call the getThread endpoint.

Because threads can take time to process, you will probably need to poll on this endpoint.

We recommend 3-5 second intervals. Here's the logic for polling:

Add a Message to an Existing Thread

Use the same endpoint but include the thread_id to add a message to your thread.

Last updated