Chat History

Manage persistent chat conversations

Overview

Store and manage chat conversations across sessions.

Authentication: API Key or OAuth token
Required Scopes (OAuth): chats:read, chats:write


List Chats

Get all saved conversations.

Endpoint: GET /api/v1/chats

const response = await fetch('https://hypery.ai/api/v1/chats', {
  headers: {
    'Authorization': `Bearer ${apiKey}`
  }
})
 
const { chats } = await response.json()

Response:

{
  "success": true,
  "chats": [
    {
      "id": "chat_123",
      "title": "Product Ideas Discussion",
      "lastMessage": "That's a great idea!",
      "messageCount": 15,
      "createdAt": "2025-11-16T10:00:00Z",
      "updatedAt": "2025-11-16T10:30:00Z"
    }
  ]
}

Create Chat

Start a new conversation.

Endpoint: POST /api/v1/chats

const response = await fetch('https://hypery.ai/api/v1/chats', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    title: 'New Conversation'
  })
})
 
const { chat } = await response.json()

Input Parameters

ParameterTypeRequiredDescription
titlestringNoChat title (auto-generated if not provided)

Get Chat

Get a specific conversation with messages.

Endpoint: GET /api/v1/chats/:id

const response = await fetch(
  `https://hypery.ai/api/v1/chats/${chatId}`,
  { headers: { 'Authorization': `Bearer ${apiKey}` } }
)
 
const { chat } = await response.json()

Update Chat

Rename or modify a chat.

Endpoint: PATCH /api/v1/chats/:id

await fetch(`https://hypery.ai/api/v1/chats/${chatId}`, {
  method: 'PATCH',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    title: 'Updated Title'
  })
})

Delete Chat

Permanently delete a conversation.

Endpoint: DELETE /api/v1/chats/:id

await fetch(`https://hypery.ai/api/v1/chats/${chatId}`, {
  method: 'DELETE',
  headers: {
    'Authorization': `Bearer ${apiKey}`
  }
})

Get Messages

Get messages for a chat.

Endpoint: GET /api/v1/chats/:id/messages

const response = await fetch(
  `https://hypery.ai/api/v1/chats/${chatId}/messages`,
  { headers: { 'Authorization': `Bearer ${apiKey}` } }
)
 
const { messages } = await response.json()

Usage with Chat API

Use the x-chat-id header to associate completions with a chat:

const response = await client.chat.completions.create({
  model: 'anthropic/claude-3.5-sonnet',
  messages: [...],
}, {
  headers: {
    'x-chat-id': chatId  // Link to existing chat
  }
})

Messages are automatically saved to the chat history.


Next Steps