# Tạo tác vụ ‘DataForSEO Trends Demography’ trực tiếp

**API:** Data API

**Endpoint:** `POST /v1/beta/dataforseo/keywords_data/dataforseo_trends/demography/live`

**Tags:** DataForSEO

Đối tượng Google Trends đứng sau một từ khóa: phân tách theo độ tuổi và giới tính trên cùng cửa sổ thời gian mà `post_dataforseo_keywords_trends_explore_live` dùng, với cùng đối số `type` và ngày. Được bọc trong phong bì của DataForSEO: dữ liệu ở `tasks[0].result`, kết quả ở `tasks[0].status_code` - yêu cầu bị từ chối vẫn trả về HTTP 200. Rẻ như endpoint anh em của nó. Để biết ở đâu thay vì ai, dùng `post_dataforseo_keywords_trends_subregion_interests_live`.

### Tham chiếu giá

- Đo lường: Chi phí phản hồi được báo cáo.
- Ước tính tham chiếu cho mỗi yêu cầu: USD 0.0024.
- Hệ số khách hàng tham chiếu: 1.0. Không áp dụng lại cho số tiền khách hàng đã quyết toán.

Chỉ là siêu dữ liệu tham chiếu, không phải báo giá cho tài khoản, mức giá được bảo đảm hay hạn mức chi tiêu. Tín dụng tài nguyên không phải tín dụng Felo. Khoản phí cuối cùng tuân theo bản ghi thanh toán của Felo.

## Related links

- [bài viết Trung tâm trợ giúp](<https://dataforseo.com/help-center/rules-and-limitations-of-keyword-and-keywords-fields-in-dataforseo-apis>)

## Base URL

- `https://openapi.felo.ai`

## Authentication

- `FeloBearerAuth` (http bearer, bearer format Felo API Key)
- `FeloApiKey` (apiKey in header `X-API-Key`)

## Request body

Required: **no**

### application/json

Schema:

```json
{
  "type": "array",
  "items": {
    "type": [
      "object",
      "null"
    ],
    "oneOf": [
      {
        "type": "object",
        "properties": {
          "keywords": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "<em>từ khóa</em><br><strong>trường bắt buộc</strong><br>số lượng từ khóa tối đa bạn có thể chỉ định: 5<br>tránh ký hiệu và ký tự đặc biệt (ví dụ: ký hiệu UTF, emoji);<br>khi chỉ định ký tự không phải Latinh, bạn sẽ nhận dữ liệu cho các quốc gia sử dụng các ký tự đó<p>tìm hiểu thêm về quy tắc và giới hạn của các trường <code>keyword</code> và <code>keywords</code> trong API DataForSEO tại bài viết Trung tâm trợ giúp"
          },
          "location_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>tên đầy đủ của vị trí công cụ tìm kiếm</em><br>trường tùy chọn<br>nếu bạn không dùng trường này, bạn sẽ nhận kết quả toàn cầu<br><strong>nếu bạn dùng trường này, bạn không cần chỉ định <code>location_code</code></strong><br>bạn có thể nhận danh sách vị trí khả dụng của công cụ tìm kiếm cùng <code>location_name</code> bằng cách gửi một yêu cầu riêng đến <code>https://api.dataforseo.com/v3/keywords_data/dataforseo_trends/locations</code><br><strong>lưu ý rằng dữ liệu sẽ được cung cấp cho quốc gia mà <code>location_name</code> đã chỉ định thuộc về;</strong><br>ví dụ:<br><code class=\"long-string\">United Kingdom</code>"
          },
          "location_code": {
            "type": [
              "integer",
              "null"
            ],
            "description": "<em>mã vị trí của công cụ tìm kiếm</em><br>trường tùy chọn<br>nếu bạn không dùng trường này, bạn sẽ nhận kết quả toàn cầu<br><strong>nếu bạn dùng trường này, bạn không cần chỉ định <code>location_name</code></strong><br>bạn có thể nhận danh sách vị trí khả dụng của các công cụ tìm kiếm cùng <code>location_code</code> bằng cách gửi một yêu cầu riêng đến <code>https://api.dataforseo.com/v3/keywords_data/dataforseo_trends/locations</code><br><strong>lưu ý rằng dữ liệu sẽ được cung cấp cho quốc gia mà <code>location_code</code> đã chỉ định thuộc về;</strong><br>ví dụ:<br><code class=\"long-string\">2840</code>"
          },
          "type": {
            "type": [
              "string",
              "null"
            ],
            "description": "loại phần tử"
          },
          "date_from": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>ngày bắt đầu của khoảng thời gian</em><br>trường tùy chọn<br>nếu bạn không chỉ định trường này, ngày và tháng hiện tại của năm trước sẽ được dùng theo mặc định<br>giá trị tối thiểu cho loại <code>web</code>: <code>2004-01-01</code><br>giá trị tối thiểu cho các loại khác: <code>2008-01-01</code><br>định dạng ngày: <code>\"yyyy-mm-dd\"</code><br>ví dụ:<br><code>\"2019-01-15\"</code>"
          },
          "date_to": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>ngày kết thúc của khoảng thời gian</em><br>trường tùy chọn<br>nếu bạn không chỉ định trường này, ngày hôm nay sẽ được dùng theo mặc định<br>định dạng ngày: <code>\"yyyy-mm-dd\"</code><br>ví dụ:<br><code>\"2019-01-15\"</code>"
          },
          "time_range": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>khoảng thời gian đặt trước</em><br>trường tùy chọn<br>nếu bạn chỉ định tham số <code>date_from</code> hoặc <code>date_to</code>, trường này sẽ bị bỏ qua khi thiết lập tác vụ<br><em>giá trị khả dụng cho tất cả tham số <code>type</code>:</em><br><code>past_4_hours</code>, <code>past_day</code>, <code>past_7_days</code>, <code>past_30_days</code>, <code>past_90_days</code>, <code>past_12_months</code>, <code>past_5_years</code>"
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>mã định danh tác vụ do người dùng xác định</em><br>trường tùy chọn<br><em>giới hạn ký tự là 255</em><br>bạn có thể dùng tham số này để nhận diện tác vụ và khớp với kết quả<br>bạn sẽ thấy giá trị <code>tag</code> đã chỉ định trong đối tượng <code>data</code> của phản hồi"
          }
        },
        "example": [
          {
            "keywords": [
              "rugby",
              "cricket"
            ],
            "date_from": "2023-01-01",
            "date_to": "2024-01-01",
            "type": "web",
            "location_name": "United States"
          }
        ]
      }
    ]
  },
  "example": [
    {
      "keywords": [
        "rugby",
        "cricket"
      ],
      "date_from": "2023-01-01",
      "date_to": "2024-01-01",
      "type": "web",
      "location_name": "United States"
    }
  ]
}
```

## Responses

### 200 — Thao tác thành công

Headers:
- `X-Request-Id` (string) — Mã định danh yêu cầu cần bao gồm khi liên hệ bộ phận hỗ trợ Felo.

**application/json**

Schema: object | null

```json
{
  "type": [
    "object",
    "null"
  ],
  "oneOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_KeywordsDataDataforseoTrendsDemographyLiveResponseInfo"
    }
  ]
}
```

### 400 — Không thể xử lý yêu cầu. Hãy kiểm tra các tham số yêu cầu.

### 401 — Cần có khóa API Felo hợp lệ.

### 402 — Không thể tiếp tục yêu cầu vì chưa đáp ứng yêu cầu thanh toán.

### 403 — Tài khoản không được phép thực hiện thao tác này.

### 429 — Đã đạt giới hạn yêu cầu hoặc giới hạn chi tiêu.

### 502 — Dịch vụ không thể hoàn tất yêu cầu.

### 503 — API hoặc dịch vụ thanh toán tạm thời không khả dụng.

### 504 — Dịch vụ đã hết thời gian chờ khi xử lý yêu cầu.

### default — Phản hồi lỗi; phản hồi chuyển tiếp từ thượng nguồn có thể dùng định dạng của nhà cung cấp

**application/json**

Schema:

```json
{}
```

## Schema definitions

### Response36Afe1097B20_BaseKeywordDataDataforseoTrendsItem

`#/components/schemas/Response36Afe1097B20_BaseKeywordDataDataforseoTrendsItem`

```json
{
  "type": "object",
  "properties": {
    "type": {
      "type": [
        "string",
        "null"
      ],
      "description": "loại phần tử"
    },
    "position": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>căn chỉnh của phần tử</em><br>có thể nhận các giá trị sau: <code>1</code>, <code>2</code>, <code>3</code>, <code>4</code>, v.v."
    },
    "keywords": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "string",
          "null"
        ]
      },
      "description": "<em>các từ khóa trong mảng POST</em>"
    }
  },
  "additionalProperties": false,
  "discriminator": {
    "propertyName": "type",
    "mapping": {
      "dataforseo_trends_graph": "#/components/schemas/Response36Afe1097B20_DataforseoTrendsDataforseoTrendsGraphElementItem",
      "subregion_interests": "#/components/schemas/Response36Afe1097B20_DataforseoTrendsSubregionInterestsElementItem",
      "demography": "#/components/schemas/Response36Afe1097B20_DataforseoTrendsDemographyElementItem"
    }
  }
}
```

### Response36Afe1097B20_BaseResponseInfo

`#/components/schemas/Response36Afe1097B20_BaseResponseInfo`

```json
{
  "properties": {
    "version": {
      "type": [
        "string",
        "null"
      ],
      "description": "phiên bản hiện tại của API"
    },
    "status_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "mã trạng thái chung; bạn có thể tìm danh sách đầy đủ các mã phản hồi tại đây"
    },
    "status_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "thông điệp thông tin chung; bạn có thể tìm danh sách đầy đủ các thông điệp thông tin chung tại đây"
    },
    "time": {
      "type": [
        "string",
        "null"
      ],
      "description": "tổng thời gian thực thi, giây"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "tổng chi phí tác vụ, USD",
      "format": "double"
    },
    "tasks_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "số lượng tác vụ trong mảng tasks",
      "format": "int64"
    },
    "tasks_error": {
      "type": [
        "integer",
        "null"
      ],
      "description": "số lượng tác vụ trong mảng tasks được trả về kèm lỗi",
      "format": "int64"
    }
  }
}
```

### Response36Afe1097B20_BaseResponseTaskInfo

`#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo`

```json
{
  "properties": {
    "id": {
      "type": [
        "string",
        "null"
      ],
      "description": "mã định danh tác vụ; mã định danh tác vụ duy nhất trong hệ thống của chúng tôi ở định dạng UUID"
    },
    "status_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "mã trạng thái của tác vụ do DataForSEO tạo; có thể nằm trong khoảng sau: 10000-60000; bạn có thể tìm danh sách đầy đủ các mã phản hồi tại đây"
    },
    "status_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "thông điệp thông tin của tác vụ; bạn có thể tìm danh sách đầy đủ các thông điệp thông tin chung tại đây"
    },
    "time": {
      "type": [
        "string",
        "null"
      ],
      "description": "thời gian thực thi, giây"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "tổng chi phí tác vụ, USD",
      "format": "double"
    },
    "result_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "số phần tử trong mảng kết quả",
      "format": "int64"
    },
    "path": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "string",
          "null"
        ]
      },
      "description": "Đường dẫn URL"
    },
    "data": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "object",
          "null"
        ]
      },
      "description": "chứa các tham số giống như bạn đã chỉ định trong yêu cầu POST"
    }
  }
}
```

### Response36Afe1097B20_DataforseoTrendsDataInfo

`#/components/schemas/Response36Afe1097B20_DataforseoTrendsDataInfo`

```json
{
  "type": "object",
  "properties": {
    "keyword": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>từ khóa liên quan mà dữ liệu nhân khẩu học được cung cấp</em>"
    },
    "values": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_DemographyItemValueInfo"
          }
        ]
      },
      "description": "<em>chứa khoảng độ tuổi và giá trị mức độ phổ biến từ khóa tương ứng</em>"
    }
  }
}
```

### Response36Afe1097B20_DataforseoTrendsDemographyElementItem

`#/components/schemas/Response36Afe1097B20_DataforseoTrendsDemographyElementItem`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseKeywordDataDataforseoTrendsItem"
    },
    {
      "type": "object",
      "properties": {
        "demography": {
          "type": [
            "object",
            "null"
          ],
          "oneOf": [
            {
              "$ref": "#/components/schemas/Response36Afe1097B20_Demography"
            }
          ],
          "description": "<em>phân tích nhân khẩu học của dữ liệu mức độ phổ biến từ khóa theo từng thuật ngữ được chỉ định</em><br>chứa dữ liệu mức độ phổ biến từ khóa theo độ tuổi và giới tính"
        },
        "demography_comparison": {
          "type": [
            "object",
            "null"
          ],
          "oneOf": [
            {
              "$ref": "#/components/schemas/Response36Afe1097B20_DemographyComparisonInfo"
            }
          ],
          "description": "<em>so sánh dữ liệu nhân khẩu học về mức độ phổ biến từ khóa cho các tham số được chỉ định</em><br>chứa dữ liệu mức độ phổ biến từ khóa theo độ tuổi và giới tính<br>nếu bạn chỉ định một từ khóa, giá trị sẽ là <code>null</code>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_Demography

`#/components/schemas/Response36Afe1097B20_Demography`

```json
{
  "type": "object",
  "properties": {
    "age": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_DataforseoTrendsDataInfo"
          }
        ]
      },
      "description": "<em>phân bố mức độ phổ biến từ khóa theo độ tuổi</em>"
    },
    "gender": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_DataforseoTrendsDataInfo"
          }
        ]
      },
      "description": "<em>phân bố mức độ phổ biến từ khóa theo giới tính</em>"
    }
  }
}
```

### Response36Afe1097B20_DemographyComparisonInfo

`#/components/schemas/Response36Afe1097B20_DemographyComparisonInfo`

```json
{
  "type": "object",
  "properties": {
    "age": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "description": "loại phần tử"
    },
    "gender": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "description": "loại phần tử"
    }
  }
}
```

### Response36Afe1097B20_DemographyItemValueInfo

`#/components/schemas/Response36Afe1097B20_DemographyItemValueInfo`

```json
{
  "type": "object",
  "properties": {
    "type": {
      "type": [
        "string",
        "null"
      ],
      "description": "loại phần tử"
    },
    "value": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>tỷ lệ mức độ phổ biến từ khóa trong khoảng độ tuổi được chỉ định</em><br>dùng <code>value</code> này, bạn có thể hiểu mức độ phổ biến của một từ khóa trong từng khoảng độ tuổi; <br>cách tính: chúng tôi xác định giá trị phổ biến cao nhất cho từ khóa liên quan trên tất cả nhóm tuổi, rồi biểu thị mọi giá trị khác dưới dạng phần trăm của giá trị cao nhất đó (100);<br>giá trị <code>100</code> là mức phổ biến cao nhất cho thuật ngữ<br>giá trị <code>0</code> nghĩa là không có đủ dữ liệu cho thuật ngữ này"
    }
  }
}
```

### Response36Afe1097B20_KeywordsDataDataforseoTrendsDemographyLiveResponseInfo

`#/components/schemas/Response36Afe1097B20_KeywordsDataDataforseoTrendsDemographyLiveResponseInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseInfo"
    },
    {
      "type": "object",
      "properties": {
        "tasks": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": [
              "object",
              "null"
            ],
            "oneOf": [
              {
                "$ref": "#/components/schemas/Response36Afe1097B20_KeywordsDataDataforseoTrendsDemographyLiveTaskInfo"
              }
            ]
          },
          "description": "<em>mảng tác vụ</em>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_KeywordsDataDataforseoTrendsDemographyLiveResultInfo

`#/components/schemas/Response36Afe1097B20_KeywordsDataDataforseoTrendsDemographyLiveResultInfo`

```json
{
  "type": "object",
  "properties": {
    "keywords": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "string",
          "null"
        ]
      },
      "description": "<em>các từ khóa trong mảng POST</em>"
    },
    "type": {
      "type": [
        "string",
        "null"
      ],
      "description": "loại phần tử"
    },
    "location_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>mã vị trí trong một mảng POST</em><br>nếu không có dữ liệu, giá trị là_<code>null</code>n"
    },
    "language_code": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>mã ngôn ngữ trong một mảng POST</em><br>nếu không có dữ liệu, giá trị là_<code>null</code>n"
    },
    "datetime": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>ngày và giờ nhận được kết quả</em><br>theo định dạng UTC: “yyyy-mm-dd hh-mm-ss +00:00”<br>ví dụ:<br><code class=\"long-string\">2019-11-15 12:57:46 +00:00</code>"
    },
    "items_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>số kết quả được trả về trong mảng <strong><code>items</code></strong></em>",
      "format": "int64"
    },
    "items": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_DataforseoTrendsDemographyElementItem"
          }
        ]
      },
      "description": "<em>chứa độ phổ biến của từ khóa và dữ liệu liên quan</em>"
    }
  }
}
```

### Response36Afe1097B20_KeywordsDataDataforseoTrendsDemographyLiveTaskInfo

`#/components/schemas/Response36Afe1097B20_KeywordsDataDataforseoTrendsDemographyLiveTaskInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo"
    },
    {
      "type": "object",
      "properties": {
        "result": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": [
              "object",
              "null"
            ],
            "oneOf": [
              {
                "$ref": "#/components/schemas/Response36Afe1097B20_KeywordsDataDataforseoTrendsDemographyLiveResultInfo"
              }
            ]
          },
          "description": "<em>mảng kết quả</em>"
        }
      }
    }
  ]
}
```
