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

# LinkedIn Ads Audiences: Create Audience Template

> Create a LinkedIn saved audience template from targetingCriteria - audience attributes (locations, titles, functions) and/or matched-audience segments.

Create a LinkedIn saved audience template from targetingCriteria - audience attributes (locations, titles, functions) and/or matched-audience segments.

<Info>
  Tool ID: `linkedin_ads_audiences_create_audience_template`
</Info>

## Run this action

Use the TypeScript SDK for a single call. Put `ctx.tools.execute(...)` inside a Play when the call should be durable, scheduled, or run across a CSV.

```ts theme={null}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'linkedin_ads_audiences_create_audience_template',
  {
    "name": "Example",
    "targeting_criteria": {}
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={null}
deepline tools execute linkedin_ads_audiences_create_audience_template --input '{
  "name": "Example",
  "targeting_criteria": {}
}' --json
```

## Example response

The SDK exposes this shape at `result.toolResponse.raw`. Values below are representative.

```json theme={null}
{
  "data": {
    "template": {
      "id": "id_123",
      "name": "Example",
      "description": "Example description",
      "account": "example",
      "approximate_member_count": 1,
      "created_time": 1,
      "last_modified_time": 1,
      "targeting_criteria": {}
    }
  }
}
```

Use `deepline tools get linkedin_ads_audiences_create_audience_template --json` for the latest machine-readable contract.

## Input reference

| Name                         | Type     | Required | Default | Details                                                                                                                                                                                                                                                                                                                                                         |
| ---------------------------- | -------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `payload.account_id`         | `string` | No       | —       | LinkedIn sponsored account ID. Find it in Campaign Manager under Account Assets, or in the URL as /campaignmanager/accounts/\{id}. Pass the bare numeric id or a full urn:li:sponsoredAccount:\{id}; Deepline normalizes either form. Optional: defaults to the workspace default account, or the sole enabled account when only one exists. Minimum length: 1. |
| `payload.name`               | `string` | Yes      | —       | Template name, max 100 characters. Minimum length: 1. Maximum length: 100.                                                                                                                                                                                                                                                                                      |
| `payload.description`        | `string` | No       | —       | Template description, max 500 characters. Minimum length: 1. Maximum length: 500.                                                                                                                                                                                                                                                                               |
| `payload.targeting_criteria` | `record` | Yes      | —       | LinkedIn targetingCriteria object: \{include: \{and: \[\{or: \{'urn:li:adTargetingFacet:\<facet>': \['urn:li:...']}}]}, exclude: \{or: \{...}}}. Facet URNs come from LinkedIn's Targeting Criteria Facet reference; matched-audience segments go under urn:li:adTargetingFacet:audienceMatchingSegments. LinkedIn validates facet and value URNs server-side.  |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "account_id": {
        "type": "string",
        "description": "LinkedIn sponsored account ID. Find it in Campaign Manager under Account Assets, or in the URL as /campaignmanager/accounts/{id}. Pass the bare numeric id or a full urn:li:sponsoredAccount:{id}; Deepline normalizes either form. Optional: defaults to the workspace default account, or the sole enabled account when only one exists.",
        "minLength": 1
      },
      "name": {
        "type": "string",
        "description": "Template name, max 100 characters.",
        "minLength": 1,
        "maxLength": 100
      },
      "description": {
        "type": "string",
        "description": "Template description, max 500 characters.",
        "minLength": 1,
        "maxLength": 500
      },
      "targeting_criteria": {
        "type": "object",
        "description": "LinkedIn targetingCriteria object: {include: {and: [{or: {'urn:li:adTargetingFacet:<facet>': ['urn:li:...']}}]}, exclude: {or: {...}}}. Facet URNs come from LinkedIn's Targeting Criteria Facet reference; matched-audience segments go under urn:li:adTargetingFacet:audienceMatchingSegments. LinkedIn validates facet and value URNs server-side.",
        "additionalProperties": {}
      }
    },
    "required": [
      "name",
      "targeting_criteria"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

| Name                                            | Type             | Required | Default | Details |
| ----------------------------------------------- | ---------------- | -------- | ------- | ------- |
| `result.data`                                   | `object`         | Yes      | —       | —       |
| `result.data.template`                          | `object`         | Yes      | —       | —       |
| `result.data.template.id`                       | `string`         | Yes      | —       | —       |
| `result.data.template.name`                     | `string \| null` | Yes      | —       | —       |
| `result.data.template.description`              | `string \| null` | Yes      | —       | —       |
| `result.data.template.account`                  | `string \| null` | Yes      | —       | —       |
| `result.data.template.approximate_member_count` | `number \| null` | Yes      | —       | —       |
| `result.data.template.created_time`             | `number \| null` | Yes      | —       | —       |
| `result.data.template.last_modified_time`       | `number \| null` | Yes      | —       | —       |
| `result.data.template.targeting_criteria`       | `object \| null` | Yes      | —       | —       |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "data": {
        "type": "object",
        "properties": {
          "template": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "account": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "approximate_member_count": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "created_time": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "last_modified_time": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "targeting_criteria": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": {}
              }
            },
            "required": [
              "id",
              "name",
              "description",
              "account",
              "approximate_member_count",
              "created_time",
              "last_modified_time",
              "targeting_criteria"
            ],
            "additionalProperties": true
          }
        },
        "required": [
          "template"
        ],
        "additionalProperties": true
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": true
  }
  ```
</details>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.

## Related documentation

* [SDK V2 quickstart](/docs/sdk-v2/quickstart)
* [SDK reference](/docs/sdk-v2/sdk-reference)
* [Run tools across a CSV](/docs/sdk-v2/batch-csv)
