# Tianyancha Company Dynamics (`spider_studio/tianyancha-dynamics`) Actor

Fetches a company's recent dynamics (诉讼, 变更, 处罚等) from Tianyancha (天眼查) by company gid.

- **URL**: https://apify.com/spider\_studio/tianyancha-dynamics.md
- **Developed by:** [NewLai](https://apify.com/spider_studio) (community)
- **Categories:** Automation, Developer tools, E-commerce
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 company dynamics

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

### What does **tianyancha-dynamics** do? | 天眼查企业动态与风险监控

**tianyancha-dynamics** is a **Chinese company event and legal risk monitoring scraper**. Given a company `gid`, it extracts recent events from [Tianyancha (天眼查)](https://www.tianyancha.com/) — lawsuits, court hearing announcements, administrative penalties, company record changes, event dates, and risk levels — as structured JSON.

**中文简介：** 这是一个用于**天眼查企业动态查询和企业风险监控**的 API，可批量采集工商变更、法律诉讼、开庭公告、行政处罚及风险等级，适用于合规审查、供应商监控、企业尽调和风险预警。

Each event becomes its own dataset row tagged with company ID, event type, date, and risk level. Run one-off checks in Apify Console or build recurring alerts with the Apify API, schedules, webhooks, monitoring, and integrations.

### Why use **tianyancha-dynamics**?

- **No browser, no manual login** — plain HTTP requests, so runs are fast and cheap.
- **Clean structured JSON** — every event is flattened into its own dataset row, downloadable as JSON, CSV, Excel, XML, or HTML.
- **Batch by company** — fetch many `gids` in a single run; every event lands in the same dataset.
- **Ready for automation** — combine it with Apify **scheduling**, **webhooks**, and **API access** to power risk-monitoring and compliance pipelines.
- **Apify platform advantages** — monitored runs, pay-per-use billing, proxy support, and 15 integrations out of the box.

### How to use **tianyancha-dynamics**

1. Open the Actor's **Input** tab in the Apify Console.
2. Enter one or more company `gids` (e.g. `[9519792, 9519793]`).
3. Click **Start**. The Actor fetches each company's dynamics and stores them in the run's dataset.
4. Open the run's **Dataset** tab to preview the JSON, or download it in your preferred format.

You can also run it from the command line with the Apify CLI:

```bash
apify call <username>/tianyancha-dynamics --input '{"gids": [9519792, 9519793]}'
```

### Input

The Actor takes a single input field:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `gids` | array\<integer> | Yes | Tianyancha company group IDs (gids) to fetch, e.g. `[9519792, 9519793]` |

Example input:

```json
{
  "gids": [9519792, 9519793]
}
```

All Tianyancha API requests use **Apify Residential Proxy** with the exit
location fixed to mainland China (`CN`). No custom proxy URL or proxy environment
variable is required. The Actor fails instead of falling back to a direct request.

The remaining runtime option is preset in the Actor configuration:

| Variable | Description |
|----------|-------------|
| `TYC_CONCURRENCY` | Maximum number of companies fetched concurrently. Preset and fallback: `8`. |

### Output

The Actor pushes one record per dynamic event to the default dataset. A representative (abbreviated) output item looks like:

```json
{
  "gid": 9519792,
  "eventType": "新增开庭公告",
  "dynamicDate": "2026-08-16",
  "riskLevel": 4,
  "textList": [
    { "text": "新增开庭公告，案由：侵害作品信息网络传播权纠纷", "display": true }
  ]
}
```

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

### Data table

Main fields you can expect in the output:

| Field | Description |
|-------|-------------|
| `gid` | Tianyancha company ID |
| `eventType` | Type of the dynamic event |
| `dynamicDate` | Date the event occurred |
| `textList` | Human-readable description lines |
| `riskLevel` | Risk level (higher = more severe) |
| `dimType` | Internal dimension type code |
| `appRouteUrl` | In-app deep-link to the event |

### How much does it cost to scrape Tianyancha?

Apify usage is measured in **compute units (CUs)**. Each run is a lightweight set of HTTP requests with no browser, so it consumes well under a fraction of a CU per company. With Apify's free tier, occasional lookups cost nothing. For bulk lookups, the default memory (256 MB) and short run duration keep costs minimal — you can estimate your exact spend on the Apify **Pricing** page.

### Tips or Advanced options

- **Get the right `gid`** — pair this with the `tianyancha-search` Actor to find companies by keyword, then feed their `id`s here.
- **Batch lookups** — pass many `gids` in a single run; every event is stored in the same dataset.
- **Fast and cheap** — the Actor uses plain HTTP, so it is far cheaper and faster than browser-based scrapers for the same data.

### FAQ, disclaimers, and support

- **Is this legal?** The Actor accesses Tianyancha's public mobile API. You are responsible for complying with Tianyancha's Terms of Service and applicable laws, and for how you use the data.
- **Known limitations** — the private API may change without notice; if the endpoint changes, runs may fail until the Actor is updated.
- **Need a custom solution?** For tailored scraping, bulk export, or integration work, open an issue on the **Issues** tab or reach out for a custom Actor.

This page was generated with [Apify's Actor README guidelines](https://docs.apify.com/platform/actors/development/actor-guides/actor-readme).

# Actor input Schema

## `gids` (type: `array`):

Tianyancha company group IDs (gids) whose recent dynamics to fetch, e.g. \[9519792, 9519793].

## Actor input object example

```json
{
  "gids": [
    9519792
  ]
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing the dynamics for each requested gid.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "gids": [
        9519792
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("spider_studio/tianyancha-dynamics").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "gids": [9519792] }

# Run the Actor and wait for it to finish
run = client.actor("spider_studio/tianyancha-dynamics").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "gids": [
    9519792
  ]
}' |
apify call spider_studio/tianyancha-dynamics --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,spider_studio/tianyancha-dynamics"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/qDOjCKe7Vf2sCg1hZ/builds/DKz0j5SuzadSoyuO9/openapi.json
