> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sendify.dingstore.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 查询单个营销活动

> 根据活动 ID 查询邮件营销活动摘要

根据活动 ID 查询当前 API Key 所属用户创建的邮件营销活动摘要。HTTP 响应直接返回活动对象。

```http theme={null}
GET https://api.sendify.dingstore.cn/dmx/v2/campaigns/{id}
```

<Note>
  活动不存在或创建者不是当前 API Key 所属用户时，均返回资源不存在。
</Note>

## 认证

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

## 路径参数

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `id` | `string` | 是 | 活动唯一标识，来自营销活动列表的 `id` |

## 请求示例

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl \
      "https://api.sendify.dingstore.cn/dmx/v2/campaigns/03ec9355-4bf3-4a09-9829-4f3ef1d12a90" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Accept: application/json"
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript theme={null}
    const id = "03ec9355-4bf3-4a09-9829-4f3ef1d12a90";
    const response = await fetch(
      `https://api.sendify.dingstore.cn/dmx/v2/campaigns/${encodeURIComponent(id)}`,
      { headers: { Authorization: "Bearer YOUR_API_KEY" } }
    );
    console.log(await response.json());
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    campaign_id = "03ec9355-4bf3-4a09-9829-4f3ef1d12a90"
    response = requests.get(
        f"https://api.sendify.dingstore.cn/dmx/v2/campaigns/{campaign_id}",
        headers={"Authorization": "Bearer YOUR_API_KEY"},
    )
    print(response.status_code)
    print(response.text)
    ```
  </Tab>
</Tabs>

## 成功响应

| 字段 | 类型 | 说明 |
| - | - | - |
| `id` | `string` | 活动唯一标识 |
| `name` | `string` | 用户设置的活动名称，并非邮件主题 |
| `type` | `enum<string>` | `CAMPAIGN_TYPE_NORMAL`（普通活动）或 `CAMPAIGN_TYPE_ABTEST`（A/B 测试活动） |
| `state` | `enum<string>` | 活动执行状态，见下表 |
| `createTime` | `string (date-time)` | 创建时间，RFC 3339 格式 |
| `updateTime` | `string (date-time)` | 活动记录最近更新时间，不代表统计数据刷新时间 |
| `plannedSendTime` | `string (date-time)` | 计划开始发送时间；未设置计划时缺省 |
| `startTime` | `string (date-time)` | 实际开始执行时间；尚未开始时缺省 |
| `endTime` | `string (date-time)` | 执行结束时间；尚未结束时缺省，不代表全部邮件成功送达 |
| `subject` | `string` | 普通活动的邮件主题；未配置时缺省。A/B 活动暂不返回主题及测试配置 |
| `from` | `object` | 发件地址与显示名称；未配置时缺省 |
| `from.email` | `string` | 发件邮箱地址 |
| `from.name` | `string` | 发件显示名称，未设置时为空 |
| `replyTo` | `object` | 回复地址与显示名称；未配置时缺省，不推断默认回复地址 |
| `replyTo.email` | `string` | 回复邮箱地址 |
| `replyTo.name` | `string` | 回复显示名称，未设置时为空 |

### 活动状态

| 值 | 说明 |
| - | - |
| `STATE_DRAFT` | 草稿，尚未安排发送 |
| `STATE_INPLAN` | 已安排发送，等待执行 |
| `STATE_SENDING` | 正在发送 |
| `STATE_SUSPEND` | 发送已暂停 |
| `STATE_FAILED` | 执行失败 |
| `STATE_FINISH` | 执行完成；不代表每封邮件均成功送达 |
| `STATE_CANCELLED` | 已取消 |
| `STATE_OFFLINE` | 已下线 |

## 错误响应

| HTTP 状态码 | 说明 |
| - | - |
| `401` | 访问未授权，请检查是否传递了正确的 Bearer API Key |
| `403` | 无 API 访问权限，请检查 API Key 的权限配置 |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.