> For the complete documentation index, see [llms.txt](https://docs.caresoft.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.caresoft.vn/danh-muc/restful-api-cua-caresoft/chien-dich.md).

# Chiến dịch

<figure><img src="/files/q2TnE8aEK0QDukiGlFYm" alt=""><figcaption></figcaption></figure>

## Danh sách các chiến dịch trên CareSoft

<mark style="color:green;">`GET`</mark> `{{domain}}/api/v1/campaigns`

API lấy danh sách các chiến dịch đang có. Dữ liệu được sắp xếp từ mới nhất đến cũ nhất  (theo `campaign_id`)

#### Request Body

| Name           | Type     | Description                                                                                                                  |
| -------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- |
| created\_since | DateTime | Thời điểm tạo bắt đầu từ mặc định từ ngày đầu tiên của năm                                                                   |
| created\_to    | DateTime | Thời điểm tạo tới. Mặc định là thời điểm hiện tại                                                                            |
| status         | String   | <p>Trạng thái chiến dịch cho phép các giá trị:<br>NEW: Mới<br>RUNNING: Đang chạy<br>PAUSE: Tạm dừng</p><p>STOP: Kết thúc</p> |
| page           | Int      | Trang số (mặc định 1)                                                                                                        |
| count          | Int      | Số bản ghi trên trang (mặc định 500, tối đa 500)                                                                             |

{% tabs %}
{% tab title="200: OK Kết quả" %}
{% tabs %}
{% tab title="Kết quả điển hình" %}

<pre><code>{
    "code": "ok",
    "campaigns": [
<strong>        {
</strong>            "campaign_status": "FINISHED",
            "campaign_name": "Đồng bộ chi tiết chiến dịch ",
            "campaign_id": 81584,
            "start_time": "2024-09-28 00:00:00",
            "end_time": "2024-09-28 00:00:00",
            "created_at": "2024-09-28 00:05:19",
            "v_type": 1,
            "member_status": [
                {
                    "id": 349,
                    "description": "Chưa gửi",
                    "is_default": 1,
                    "campaign_id": 81584
                },
                {
                    "id": 350,
                    "description": "Đã gửi",
                    "is_default": 0,
                    "campaign_id": 81584
                },
                {
                    "id": 351,
                    "description": "Gửi lỗi",
                    "is_default": 0,
                    "campaign_id": 81584
                },
                {
                    "id": 352,
                    "description": "Gửi thành công",
                    "is_default": 0,
                    "campaign_id": 81584
                }
            ]
        },
        {
            "campaign_status": "NEW",
            "campaign_name": "Life Event - Sự kiện",
            "campaign_id": 56618,
            "start_time": "2023-04-03 16:03:41",
            "end_time": "2023-04-03 16:03:41",
            "created_at": "2023-04-03 16:03:41"
            "v_type": 0,
        },
        {
            "campaign_status": "NEW",
            "campaign_name": "Life events - CMSN",
            "campaign_id": 56617,
            "start_time": "2023-04-03 16:03:33",
            "end_time": "2023-04-03 16:03:33",
            "created_at": "2023-04-03 16:03:33"
        },
        {
            "campaign_status": "NEW",
            "campaign_name": "Happy call",
            "campaign_id": 56616,
            "start_time": "2023-04-03 16:03:13",
            "end_time": "2023-04-03 16:03:13",
            "created_at": "2023-04-03 16:03:13"
        }
    ],
    "created_since": "2023-01-01 00:00:00",
    "created_to": "2023-04-24 15:29:36",
    "numFound": 3
}
</code></pre>

{% endtab %}

{% tab title="Mô tả kết quả" %}

<table><thead><tr><th width="102">STT</th><th width="170">Trường dữ liệu</th><th>Ghi chú</th></tr></thead><tbody><tr><td>1</td><td>code</td><td>Trạng thái thực thi <code>ok</code>, <code>errors</code></td></tr><tr><td>2</td><td>campaigns</td><td><p>Mảng dữ liệu chiến dịch</p><p>Gồm các object có cấu trúc </p><ul><li><code>campaign_status</code>: Trạng thái chiến dịch</li><li><code>campaign_name</code>: Tên chiến dịch</li><li><code>campaign_id</code>: ID chiến dịch</li><li><code>start_time</code>: Ngày bắt đầu,</li><li><code>end_time</code>:Thời điểm kết thúc</li><li><code>created_at</code>: Ngày tạo</li><li><p>v_type: Phiên bản chiến dịch (Đối với v_type=1 thì sẽ có thêm danh sách các trạng thái của chiến dịch,   member_status.id sẽ tương đương member_status_id khi tạo hay update phiếu ghi.<br></p><pre class="language-json"><code class="lang-json">  "member_status": [
                {
                    "id": 349,
                    "description": "Chưa gửi",
                    "is_default": 1,
                    "campaign_id": 81584
                },...
</code></pre></li></ul></td></tr><tr><td>3</td><td>created_to</td><td>Thời điểm lọc chiến dịch đến theo ngày tạo</td></tr><tr><td>4</td><td>numFound</td><td>Số lượng chiến dịch tìm ra</td></tr><tr><td>5</td><td>created_since</td><td>Thời điểm lọc chiến dịch đến theo ngày tạo</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.caresoft.vn/danh-muc/restful-api-cua-caresoft/chien-dich.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
