# Create Audience — TikTok Ads Manager

> Create a new TikTok custom audience from hashed customer identifiers. Uploads the identifiers first, then creates the audience — both steps happen in one tool call. Provide either identifiers (a list of SHA256-hashed values passed…

- Key: `tiktok_ads_manager-create-audience`
- Type: Action (Write)
- Version: 0.0.2
- App: TikTok Ads Manager (`tiktok_ads_manager`) — https://pipedream.com/apps/tiktok-ads-manager.md
- This page (HTML): https://pipedream.com/apps/tiktok-ads-manager/actions/create-audience
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/tiktok_ads_manager/actions/create-audience/create-audience.mjs

## Description

Create a new TikTok custom audience from hashed customer identifiers. Uploads the identifiers first, then creates the audience — both steps happen in one tool call. Provide either `identifiers` (a list of SHA256-hashed values passed directly) or `file_path` (a CSV file with one identifier per line). `identifier_type` controls the hash format: `EMAIL_SHA256` for hashed emails, `PHONE_SHA256` for hashed phone numbers, `IDFA_SHA256` or `GAID_SHA256` for device IDs. To add members to an existing audience, use **Update Audience** instead. [See the documentation](https://business-api.tiktok.com/portal/docs/create-an-audience-by-file/v1.3)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `advertiserId` | `string` | Yes | Your TikTok Ads Manager advertiser ID. Find it in the Ads Manager URL after aadvid= (e.g., aadvid=7123456789012345678). Also visible under Account Info in Business Center. |
| `audienceName` | `string` | Yes | Display name for the new custom audience. |
| `calculateType` | `string` | Yes | Hash type and identifier format. EMAIL_SHA256 for SHA256-hashed email addresses (most common). PHONE_SHA256 for SHA256-hashed phone numbers. IDFA_SHA256 / IDFA_MD5 for Apple device IDs. GAID_SHA256 / GAID_MD5 for Android device IDs. MULTIPLE_TYPES when the file contains a mix. |
| `identifiers` | `string[]` | No | List of SHA256-hashed identifiers to seed the audience with. Pass these directly instead of a file. Example: ["a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"]. Use this when you have the hashed values inline; use file_path when the data is in a file. |
| `filePath` | `string` | No | CSV/text file with one SHA256-hashed identifier per line. Provide a /tmp file path or a publicly accessible URL. Use identifiers instead if you have the values inline. |
| `retentionDays` | `integer` | No | How many days to retain audience members (default: 365, max: 365). |
| `syncDir` | `dir` | No | SyncDir |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "tiktok_ads_manager",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "tiktok_ads_manager-create-audience",
  arguments: {
    advertiserId: "Advertiser ID",
    audienceName: "Audience Name",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "tiktok_ads_manager-create-audience",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    tiktok_ads_manager: { authProvisionId: "apn_xxxxxxx" },
    advertiserId: "Advertiser ID",
    audienceName: "Audience Name",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "tiktok_ads_manager-create-audience",
    "configured_props": {
      "tiktok_ads_manager": { "authProvisionId": "apn_xxxxxxx" },
      "advertiserId": "Advertiser ID",
      "audienceName": "Audience Name"
    }
  }'
```

---

- App: https://pipedream.com/apps/tiktok-ads-manager.md · All apps: https://pipedream.com/apps
