Vardast

Public API Documentation

advanced By Vardast Team

Base URL

Base URL: https://apigw.vardast.chat/uaa/public

Authorization

API Key

Set X-API-Key header in your requests.

"X-API-Key": "VdHRqM5x2h18QVj29298Ae3MZ6PG3f3-m6RJ6Yxeg1Q"

Chat

Process message

  • Endpoint: POST /messenger/api/chat/public/process
  • Request Body: PublicChatRequest
{
"message": "string",
"channel_id": "string",
"contact_id": "string",
"assistant_id": "string | null" // Optional, defaults to channel's assistant
}
  • Response:
{
"status": "success | error",
"message_id": "uuid", // ID of the saved message if successful
"response": "string", // The AI response if successful
"error": "string" // Error message if failed
}

Get Contact Messages

  • Endpoint: GET /messenger/api/chat/{channel_id}/{contact_id}/
  • Query Parameters:
  • page: int (optional, default=1) - Page number
  • size: int (optional, default=20) - Items per page
  • Response: PaginatedResponse[MessageResponse]
{
    "items": [
        {
            "id": "uuid",
            "text": "string",
            "platform": "string",
            "sender_id": "string",
            "receiver_id": "string",
            "is_output": "boolean",
            "ai_created": "boolean",
            "channel_id": "uuid",
            "timestamp": "datetime",
            "is_in_thread": "boolean"
        }
    ],
    "total": "int",
    "page": "int",
    "size": "int",
    "pages": "int"
}

Get All Contacts

  • Endpoint: GET /messenger/api/chat/contacts/
  • Query Parameters:
  • page: int (optional, default=1) - Page number
  • size: int (optional, default=20) - Items per page
  • channel_ids: string (optional) - Comma-separated list of channel IDs
  • platform: string (optional) - Filter by platform (TELEGRAM, INSTAGRAM, etc.)
  • Response: PaginatedResponse[ContactResponse]
{
    "items": [
        {
            "id": "uuid",
            "name": "string",
            "username": "string",
            "identifier": "string",
            "platform": "string",
            "channel_id": "uuid",
            "is_stopped": "boolean",
            "created_at": "datetime",
            "updated_at": "datetime"
        }
    ],
    "total": "int",
    "page": "int",
    "size": "int",
    "pages": "int"
}

Channels

Get All Channels

  • Endpoint: GET /messenger/api/channel/
  • Response: List of ChannelResponse
{
  "items": [
    {
      "id": "uuid",
      "name": "string",
      "platform": "INSTAGRAM | TELEGRAM | BALE",
      "user_id": "string",
      "identifier": "string",
      "access_token": "string",
      "assistant": "string | null",
      "is_stopped": "boolean",
      "reply_to_story": "boolean",
      "reply_to_comments": "boolean",
      "account_id": "string",
      "created_at": "datetime",
      "updated_at": "datetime"
    }
  ]
}

Assistants

Get Assistants

  • Endpoint: GET /messenger/api/assistants/
  • Response: List of assistants sorted by creation date (newest first)
{
  "items": [
    {
      "id": "uuid",
      "assistant_name": "string",
      "model": "string",
      "api_key": "string",
      "kb_id": "uuid | null",
      "functions": ["string"] | null,
      "user_id": "uuid",
      "created_at": "datetime",
      "updated_at": "datetime"
    }
  ]
}

Create Assistant

  • Endpoint: POST /messenger/api/assistants/
  • Request Body: AssistantCreate
{
  "assistant_name": "string",
  "model": "string",
  "api_key": "string",
  "kb_id": "uuid | null",
  "functions": ["string"] | null
}

Prompts

Create Prompt

  • Endpoint: POST /messenger/api/prompts/
  • Request Body: PromptCreate
{
    "assistant_id": "UUID",
    "text": "string",
    "prompt_json": "object",
    "language": "FA | EN",  // Defaults to "EN"
    "created_by": "string"
}
  • Response: Prompt
{
  "prompt_id": "uuid",
  "created_at": "datetime",
  "updated_at": "datetime",
  "user_id": "uuid"
}

Get Prompt

  • Endpoint: GET /messenger/api/prompts/{prompt_id}
  • Response: Prompt
{
  "prompt_id": "uuid",
  "assistant_id": "uuid",
  "text": "string",
  "prompt_json": "object",
  "language": "FA | EN",
  "created_by": "string",
  "created_at": "datetime",
  "updated_at": "datetime",
  "user_id": "uuid"
}

Get Channel Contacts

GET /report/channel/{channel_id}/contacts

Retrieves contacts for a specific channel with pagination support.

Query Parameters:

  • id: UUID (optional) - Get specific contact
  • page: int (optional, ≥1) - Page number
  • page_size: int (optional, ≥1, ≤100) - Items per page

Response Schema:

{
    "items": [
        {
            "id": "UUID",
            "contact_id": "UUID",
            "channel_id": "UUID",
            "full_name": "string",
            "phone_number": "string",
            "detailed_address": "string",
            "postal_code": "string (optional)",
            "username": "string (optional)",
            "platform": "string (optional)",
            "comment": "string (optional)",
            "order_list": [
                {
                    "product_name": "string",
                    "quantity": "int",
                    "variants": "string (optional)"
                }
            ],
            "created_at": "datetime (optional)"
        }
    ],
    "total": "int",
    "page": "int",
    "size": "int",
    "pages": "int"
}

Get Channel Orders

GET /report/channel/{channel_id}/orders

Retrieves orders for a specific channel with pagination support.

Query Parameters:

  • order_id: UUID (optional) - Get specific order
  • page: int (optional, ≥1) - Page number
  • page_size: int (optional, ≥1, ≤100) - Items per page

Response Schema:

{
    "items": [
        {
            "id": "UUID",
            "contact_id": "UUID",
            "channel_id": "UUID",
            "full_name": "string",
            "phone_number": "string",
            "detailed_address": "string",
            "postal_code": "string (optional)",
            "username": "string (optional)",
            "platform": "string (optional)",
            "comment": "string (optional)",
            "order_list": [
                {
                    "product_name": "string",
                    "quantity": "int",
                    "variants": "string (optional)"
                }
            ],
            "created_at": "datetime (optional)"
        }
    ],
    "total": "int",
    "page": "int",
    "size": "int",
    "pages": "int"
}

Usage

Get User Usage Info

  • Endpoint: GET /payment/get-usage-info/
  • Response: UsageResponseSchema
{
    "status": "string",
    "response": {
        "user_id": "uuid",
        "mode": "string",
        "active_features": {
            "feature_name": "boolean"
        },
        "chat_credit": "integer",
        "all_chat_credit": "integer",
        "total_chats": "integer",
        "contact_credit": "integer",
        "total_contacts": "integer",
        "is_allowed": "boolean",
        "next_due_date": "datetime",
        "time_credit": "datetime"
    }
}

Get Usage Activity

  • Endpoint: GET /payment/get-usage-activity/
  • Query Parameters:
  • feature: string (required: iddatemodeperiod)
  • activity_id: uuid (required if feature=id)
  • date: datetime (required if feature=date)
  • mode: string (required if feature=mode)
  • start_date: string (required if feature=period)
  • end_date: string (required if feature=period)
  • Response: UsageActivityResponseSchema
{
    "status": "string",
    "response": {
        "id": "uuid",
        "user_id": "uuid",
        "date": "date",
        "new_contacts": "integer",
        "message_requests": "integer"
    }
}

Usage Activity Summary Response

{
    "status": "string",
    "response": [
        {
            "date": "date | string",
            "total_new_contacts": "integer",
            "total_message_requests": "integer"
        }
    ]
}

Error Responses

All endpoints may return the following error responses:

  • 401 Unauthorized: When authentication fails
  • 404 Not Found: When the requested resource is not found
  • 500 Internal Server Error: When an unexpected error occurs

Error response format:

{
"detail": "Error message"
}