AISARAISAR
REST API

Snippets

Snippets (quick replies) are pre-written text blurbs, optionally with attached files, that the company prepares so an operator can insert them into a chat in one action instead of typing. Unlike message templates, snippets are not moderated by the provider and can only be used inside an already-open 24-hour messaging window. Create/update use `multipart/form-data` since they support file uploads.

Endpoints

MethodPath
GET/v1/snippets

List the company's snippets.

POST/v1/snippets

Create a snippet (multipart/form-data, files supported).

POST/v1/snippets/{snippet}

Update a snippet — text, add/remove files (multipart/form-data).

DELETE/v1/snippets/{snippet}

Delete a snippet.

GET/v1/snippets/{snippet}/files/{snippetFile}/download

Download a file attached to a snippet (via a signed URL).

Examples

Create a snippet

Request

bash
curl -X POST "https://api.aisar.app/v1/snippets" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -F "name=Приветствие" \
  -F "message=Здравствуйте! Чем можем помочь?" \
  -F "files[]=@/path/to/price-list.pdf"

Response

json
{
  "data": {
    "id": 9,
    "company_id": 1,
    "name": "Приветствие",
    "message": "Здравствуйте! Чем можем помочь?",
    "files": [
      {
        "id": 21,
        "name": "price-list.pdf",
        "size": 48213,
        "type": "application/pdf",
        "download_url": "https://api.aisar.app/v1/snippets/9/files/21/download?expires=...&signature=..."
      }
    ],
    "updated_at": "2026-02-09T18:00:00Z"
  }
}

List snippets

Request

bash
curl -X GET "https://api.aisar.app/v1/snippets" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "data": [
    {
      "id": 9,
      "company_id": 1,
      "name": "Приветствие",
      "message": "Здравствуйте! Чем можем помочь?",
      "files": [],
      "updated_at": "2026-02-09T18:00:00Z"
    }
  ]
}