---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://docs.sendcorex.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://docs.sendcorex.com/llms.txt"
---

Source: https://docs.sendcorex.com/vi/api-reference/contacts/fields/list-fields

Liên hệ: trường tùy chỉnh

# Liệt kê trường

Mọi trường tùy chỉnh của tài khoản, kèm kiểu và tùy chọn, sắp theo khóa.

POST `https://g.sendcorex.com/v1/contacts` command: list_fields

Cần phạm vi `contact:read` trên API key của bạn.

## Tham số

Endpoint này không có đối số.

## Bắt đầu nhanh

```
import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/contacts',
  {
    commands: [
      {
        command: "list_fields"
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);
```

## Phản hồi

```
{
  "type": "SUCCESS",
  "results": [
    {
      "command": "list_fields",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 14,
      "data": {
        "fields": [
          {
            "key": "age",
            "name": "Age",
            "type": "number",
            "options": null,
            "created_at": "2026-10-01T10:00:00.000Z",
            "updated_at": "2026-10-01T10:00:00.000Z"
          },
          {
            "key": "plan",
            "name": "Plan",
            "type": "enum",
            "options": [
              "free",
              "pro",
              "business"
            ],
            "created_at": "2026-10-01T10:00:00.000Z",
            "updated_at": "2026-10-01T10:00:00.000Z"
          }
        ],
        "limit": 100
      }
    }
  ]
}
```

### Trường phản hồi

- `fields[].key`
Khóa dùng trong `fields`, trong `where` và trong `sort` (`fields.<key>`).
- `fields[].name`
Tên hiển thị.
- `fields[].type`
`text`, `number`, `date`, `bool`, `enum` hoặc `multi_enum`.
- `fields[].options`
Các giá trị cho phép của trường `enum` và `multi_enum`.
- `limit`
Số trường tài khoản có thể có (100).

## Lỗi

Lỗi ở mức HTTP trả về `type`, `code` và `message`. Lỗi đánh dấu CMD được trả về trong kết quả lệnh, với HTTP 200.

- 401`INVALID_API_KEY`
API key không tồn tại, đã bị thu hồi hoặc bị tắt trong dashboard.
- 429`RATE_LIMITED`
Hơn 15 yêu cầu/giây hoặc 15 yêu cầu đồng thời cho cùng IP + API key. Chờ số giây trong Retry-After.
- CMD`MISSING_SCOPE`
API key không có phạm vi lệnh này cần. Các lệnh khác trong yêu cầu vẫn chạy.
- CMD`INTERNAL`
Lỗi máy chủ. Chi tiết chỉ được ghi vào log máy chủ.
