Skip to content

Quickstart

The Sociable AI API offers a streamlined interface for programmatically accessing and interacting with AI Personas created in the Sociable dashboard. This guide will help you get started, enabling you to effectively use your AI persona in your applications.

Create an API Key

Create your API key through the Sociable dashboard here. You may have to create an account first. Afterwards, ensure that you have selected the correct persona at the top of your screen, then navigate to Integrations->API Keys and select Create new API Key.

Integrations Page

Making Your First Request

Before generating any messages, you’ll need to create a dialogue. You’ll need its id property to generate messages later on. We can create a dialogue using the dialogue creation endpoint.. We can pass in a name property to give our dialogue a title. Here’s how you might do this:

create-dialogue.sh
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer YOUR-API-KEY-HERE" -d '{
"name": "Johnnie Walker"
}' "https://app.sociable.how/api/dialogues"

You can manage your dialogues through our create, delete, and browse endpoints.

Generating Messages

Now that you have a dialogue id, you can generate messages using the message generation endpoint.. You’ll need to pass in the dialogue id and the messages you want to send. Here’s an example:

generate-message.sh
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer YOUR-API-KEY-HERE" -d '{
"dialogueId": "9c831f86-3859-49b6-8b58-4b5425aaf131",
"messages": [
{ "role": "USER", "content": "Hello, how are you?", "type": "TEXT" }
]
}' "https://app.sociable.how/api/createChatCompletion"

We can also pass in multiple messages at once, like so:

generate-messages.sh
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer YOUR-API-KEY-HERE" -d '{
"dialogueId": "9c831f86-3859-49b6-8b58-4b5425aaf131",
"messages": [
{ "role": "USER", "content": "Hello, how are you?", "type": "TEXT" },
{ "role": "PERSONA", "content": "Good, you?", "type": "TEXT" },
{ "role": "USER", "content": "Doing great, how was your day?", "type": "TEXT" }
]
}' "https://app.sociable.how/api/createChatCompletion"

Now you’re ready to begin building your AI persona into your applications!