API reference
Julien AI
Julien AI is the assistant of the Gemlead app. Through the API it answers questions about Gemlead and about the key's X account, its leads, personas, campaigns and conversations. It only answers, and never creates, changes or sends anything.
Send a message without chat_id to start a chat, then send the next ones with the reply's chat_id to go on in it. You reach the chats made through the API with this X account, never the chats of the app.
A send waits up to 25 seconds for the answer. When Julien AI needs longer, the reply comes back with the status running. Retrieve it every few seconds until it is completed or failed, which takes 150 seconds at most.
Each X account can send 6 messages a minute and 100 a day in UTC, one at a time in a chat and 3 at once, each of 1 to 4 000 characters. Julien AI also takes 150 messages an hour per user, the app's chat and the API together.
The assistant reply object
One message to Julien AI and its answer. A send returns it, and it stays readable by its ID.
Attributes
- idstringUnique identifier for the reply,
rpl_and 32 characters. - objectstringAlways
assistant_reply. - statusstring
runningwhile Julien AI writes, thencompletedorfailed.runningcompletedfailed - chat_idstring or nullThe chat of the message. Send the next message with it to go on in the same chat.
nullwhile the first message of a new chat runs. - messageobject or null
- replyobject or null
- errorobject or nullWhy the reply failed,
nullotherwise. - created_atstringWhen the message was sent, ISO 8601.
- completed_atstring or nullWhen the reply ended, completed or failed, ISO 8601.
nullwhile it runs.
{
"id": "rpl_7Hq2LmX9vR4tKp8WzN3cYd6FbJ1sGa5E",
"object": "assistant_reply",
"status": "completed",
"chat_id": "Jc7Rk2WqNb",
"message": {
"id": "Qm4xT8vLpZ",
"object": "assistant_message",
"chat_id": "Jc7Rk2WqNb",
"role": "user",
"text": "Which persona brought the most hot leads?",
"created_at": "2026-11-06T09:14:02.000Z"
},
"reply": {
"id": "Ra9Yh3KsDw",
"object": "assistant_message",
"chat_id": "Jc7Rk2WqNb",
"role": "assistant",
"text": "Tipsters, with 38 hot leads this week out of 412 scored. Most of them follow @bettingpros.\n\nShould I compare it with last week?",
"created_at": "2026-11-06T09:14:09.000Z"
},
"error": null,
"created_at": "2026-11-06T09:14:02.000Z",
"completed_at": "2026-11-06T09:14:09.000Z"
}Send a message
Sends a message to Julien AI and waits up to 25 seconds for its answer. Past that, the reply comes back running and you retrieve it until it ends. Send it with an Idempotency-Key so a retry never asks twice.
Body parameters
- textstringRequiredYour message, 1 to 4 000 characters.
- chat_idstringThe chat to go on in, from an earlier reply. Without it, the message starts a new chat.
Returns
An assistant reply object, completed with the answer, or running when Julien AI needs more than 25 seconds.
Errors
- A required parameter is missing.
paramnames it. - The text is empty or longer than 4 000 characters.
paramnames it. - No chat with this ID made through the API with this X account. The app's own chats answer the same.
- Julien AI is still answering a message of this chat, or 3 messages of this X account.
- More than 6 messages in the minute from this X account, or 150 in the hour for its owner.
- 100 messages today in UTC from this X account.
- Julien AI is not available or could not answer. A message it received stays in the chat.
curl -X POST https://gemlead.ai/api/v1/assistant/messages \
-H "Authorization: Bearer $GEMLEAD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Which persona brought the most hot leads?"
}'{
"id": "rpl_7Hq2LmX9vR4tKp8WzN3cYd6FbJ1sGa5E",
"object": "assistant_reply",
"status": "completed",
"chat_id": "Jc7Rk2WqNb",
"message": {
"id": "Qm4xT8vLpZ",
"object": "assistant_message",
"chat_id": "Jc7Rk2WqNb",
"role": "user",
"text": "Which persona brought the most hot leads?",
"created_at": "2026-11-06T09:14:02.000Z"
},
"reply": {
"id": "Ra9Yh3KsDw",
"object": "assistant_message",
"chat_id": "Jc7Rk2WqNb",
"role": "assistant",
"text": "Tipsters, with 38 hot leads this week out of 412 scored. Most of them follow @bettingpros.\n\nShould I compare it with last week?",
"created_at": "2026-11-06T09:14:09.000Z"
},
"error": null,
"created_at": "2026-11-06T09:14:02.000Z",
"completed_at": "2026-11-06T09:14:09.000Z"
}Retrieve a reply
Returns a reply. While it is running, retrieve it every few seconds. It ends completed with Julien AI's answer, or failed with its error.
Path parameters
- reply_idstringRequiredThe reply's ID.
Returns
Errors
- No reply with this ID on the key's X account.
curl \
https://gemlead.ai/api/v1/assistant/replies/rpl_7Hq2LmX9vR4tKp8WzN3cYd6FbJ1sGa5E \
-H "Authorization: Bearer $GEMLEAD_API_KEY"{
"id": "rpl_7Hq2LmX9vR4tKp8WzN3cYd6FbJ1sGa5E",
"object": "assistant_reply",
"status": "running",
"chat_id": "Jc7Rk2WqNb",
"message": null,
"reply": null,
"error": null,
"created_at": "2026-11-06T09:14:02.000Z",
"completed_at": null
}The assistant message object
A message of a chat with Julien AI, yours or its own.
Attributes
- idstringUnique identifier for the message.
- objectstringAlways
assistant_message. - chat_idstringThe chat it belongs to.
- rolestring
userfor your messages,assistantfor Julien AI's.userassistant - textstringThe message. From Julien AI, its answer, then the question it asks you when it asks one.
- created_atstringWhen the message was sent, ISO 8601.
{
"id": "Ra9Yh3KsDw",
"object": "assistant_message",
"chat_id": "Jc7Rk2WqNb",
"role": "assistant",
"text": "Tipsters, with 38 hot leads this week out of 412 scored. Most of them follow @bettingpros.\n\nShould I compare it with last week?",
"created_at": "2026-11-06T09:14:09.000Z"
}List messages
read scopeReturns the messages of your chats with Julien AI made through the API, yours and its answers, newest first.
Query parameters
- chat_idstringOnly this chat's messages. Default every chat of this X account.
- limitintegerHow many objects to return, from 1 to 100. Defaults to 25.
- cursorstringThe
next_cursorof the previous page, to get the page after it. See Pagination.
Returns
A list of assistant message objects.
Errors
- No chat with this ID made through the API with this X account. The app's own chats answer the same.
- A parameter has a value the API does not accept.
paramnames it.
curl -G https://gemlead.ai/api/v1/assistant/messages \
-H "Authorization: Bearer $GEMLEAD_API_KEY" \
-d chat_id=Jc7Rk2WqNb{
"object": "list",
"data": [
{
"id": "Ra9Yh3KsDw",
"object": "assistant_message",
"chat_id": "Jc7Rk2WqNb",
"role": "assistant",
"text": "Tipsters, with 38 hot leads this week out of 412 scored. Most of them follow @bettingpros.\n\nShould I compare it with last week?",
"created_at": "2026-11-06T09:14:09.000Z"
},
{
"id": "Qm4xT8vLpZ",
"object": "assistant_message",
"chat_id": "Jc7Rk2WqNb",
"role": "user",
"text": "Which persona brought the most hot leads?",
"created_at": "2026-11-06T09:14:02.000Z"
}
],
"has_more": false,
"next_cursor": null
}The assistant chat object
A chat with Julien AI started through the API.
Attributes
- idstringUnique identifier for the chat, the
chat_idof its messages. - objectstringAlways
assistant_chat. - titlestringThe chat's title, as the app names its chats.
New chatuntil it has one. - created_atstringWhen the chat started, ISO 8601.
- last_message_atstringWhen its last message was sent, ISO 8601.
- last_message_previewstringThe start of its last message.
{
"id": "Jc7Rk2WqNb",
"object": "assistant_chat",
"title": "Hot leads this week",
"created_at": "2026-11-06T09:14:02.000Z",
"last_message_at": "2026-11-06T09:14:09.000Z",
"last_message_preview": "Tipsters, with 38 hot leads this week out of 412 scored."
}List chats
read scopeReturns your chats with Julien AI made through the API with this X account, the latest active first.
Query parameters
- limitintegerHow many objects to return, from 1 to 100. Defaults to 25.
- cursorstringThe
next_cursorof the previous page, to get the page after it. See Pagination.
Returns
A list of assistant chat objects.
Errors
- A parameter has a value the API does not accept.
paramnames it.
curl https://gemlead.ai/api/v1/assistant/chats \
-H "Authorization: Bearer $GEMLEAD_API_KEY"{
"object": "list",
"data": [
{
"id": "Jc7Rk2WqNb",
"object": "assistant_chat",
"title": "Hot leads this week",
"created_at": "2026-11-06T09:14:02.000Z",
"last_message_at": "2026-11-06T09:14:09.000Z",
"last_message_preview": "Tipsters, with 38 hot leads this week out of 412 scored."
}
],
"has_more": false,
"next_cursor": null
}