查詢外撥活動清單
curl --request GET \
--url https://api.pathors.com/v1/campaigns \
--header 'Authorization: <authorization>'import requests
url = "https://api.pathors.com/v1/campaigns"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.pathors.com/v1/campaigns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pathors.com/v1/campaigns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pathors.com/v1/campaigns"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pathors.com/v1/campaigns")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathors.com/v1/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": [
{
"campaign_id": "<string>",
"name": "<string>",
"status": "<string>",
"stopped_reason": {},
"created_at": "<string>",
"updated_at": "<string>",
"total_contacts": 123,
"dispatched_contacts": 123,
"completed_contacts": 123,
"connected_contacts": 123
}
]
}V1 開發者 API
查詢外撥活動清單
列出專案底下的外撥活動,最新的在前
GET
/
v1
/
campaigns
查詢外撥活動清單
curl --request GET \
--url https://api.pathors.com/v1/campaigns \
--header 'Authorization: <authorization>'import requests
url = "https://api.pathors.com/v1/campaigns"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.pathors.com/v1/campaigns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pathors.com/v1/campaigns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pathors.com/v1/campaigns"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pathors.com/v1/campaigns")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathors.com/v1/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": [
{
"campaign_id": "<string>",
"name": "<string>",
"status": "<string>",
"stopped_reason": {},
"created_at": "<string>",
"updated_at": "<string>",
"total_contacts": 123,
"dispatched_contacts": 123,
"completed_contacts": 123,
"connected_contacts": 123
}
]
}列出某個專案底下的外撥活動,依建立時間由新到舊排序。用來找出您要拉取明細的那個活動。唯讀。
請求
GET https://api.pathors.com/v1/campaigns?project_id={project_id}
標頭
string
必填
使用您的 Developer Key(
dk_...)進行 Bearer 令牌認證。查詢參數
string
必填
要列出活動的專案。Developer Key 必須有此專案的存取權。
string
以活動狀態篩選,逗號分隔(例如
active,completed)。傳入無法識別的值會回傳 400,而非靜默回傳空結果。integer
回傳筆數。預設
20,上限 100。只要最新的那一個活動就傳 limit=1。範例
curl -H "Authorization: Bearer dk_your_key" \
"https://api.pathors.com/v1/campaigns?project_id=proj_your_project_id&limit=1"
回應
array
範例
{
"data": [
{
"campaign_id": "cmp_example001",
"name": "八月會員回訪",
"status": "completed",
"stopped_reason": null,
"created_at": "2026-08-14T08:00:00.000Z",
"updated_at": "2026-08-14T10:30:00.000Z",
"total_contacts": 500,
"dispatched_contacts": 500,
"completed_contacts": 487,
"connected_contacts": 312
}
]
}
錯誤
| 狀態碼 | 時機 |
|---|---|
| 400 | 缺少 project_id、status 含無法識別的值,或 limit 超出範圍 |
| 401 | 缺少或無效的 Developer Key |
| 403 | 此 Developer Key 無權存取該專案 |
| 500 | 內部伺服器錯誤 |
說明
- 排序依據:
created_at由新到舊,不是updated_at。排程器在撥號過程中會持續改寫活動,若以最後更新排序,一個上週建立、今天還在撥的活動會蓋過今天剛建立的。 - 判斷要不要拉明細:比較
completed_contacts與total_contacts就知道活動撥完了沒,不必先去抓明細。 - 不分頁:一個專案的活動是幾十筆等級,
limit已足夠,沒有提供游標。 - 權限範圍:只會列出 Developer Key 有權存取之專案底下的活動,不提供跨專案查詢。
⌘I
