> ## 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.

# HarvestAPI: Search Ads

> Search the LinkedIn Ad Library by keyword, advertiser, country, or date. Includes SDK V2 guidance, input constraints, response fields, and Deepline credit cost.

Search the LinkedIn Ad Library by keyword, advertiser, country, or date.

<Info>
  Tool ID: `harvestapi_search_ads`
</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(
  'harvestapi_search_ads',
  {
    "searchUrl": "https://example.com",
    "keyword": "software companies hiring engineers",
    "accountOwner": "example"
  },
);

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

### CLI

```bash theme={null}
deepline tools execute harvestapi_search_ads --input '{
  "searchUrl": "https://example.com",
  "keyword": "software companies hiring engineers",
  "accountOwner": "example"
}' --json
```

## Example response

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

```json theme={null}
{
  "data": {
    "elements": [
      {}
    ],
    "pagination": {
      "totalPages": 123,
      "totalElements": 123,
      "pageNumber": 123
    },
    "status": 1
  }
}
```

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

## Input reference

Retrieve a list of LinkedIn Ads matching the specified search criteria.

| Name                      | Type     | Required | Default | Details                                                                                                                                                                                                                                                                                                                                             |
| ------------------------- | -------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `payload.searchUrl`       | `string` | No       | —       | Scrape Ad Library search URL, for example: [https://www.linkedin.com/ad-library/search?accountOwner=test\&keyword=test\&dateOption=custom-date-range\&startdate=2025-07-07\&enddate=2025-08-21](https://www.linkedin.com/ad-library/search?accountOwner=test\&keyword=test\&dateOption=custom-date-range\&startdate=2025-07-07\&enddate=2025-08-21) |
| `payload.keyword`         | `string` | No       | —       | Search by keyword                                                                                                                                                                                                                                                                                                                                   |
| `payload.accountOwner`    | `string` | No       | —       | Search by company or advertiser name                                                                                                                                                                                                                                                                                                                |
| `payload.countries`       | `string` | No       | —       | One or comma separated list of country codes to filter ads by country. Eg. 'US,GB,FR'. Supports "ALL" value to search in all countries.                                                                                                                                                                                                             |
| `payload.dateOption`      | `string` | No       | —       | One of the following options to filter ads by date: 'last-30-days', 'current-month', 'current-year', 'last-year', 'custom-date-range'                                                                                                                                                                                                               |
| `payload.startdate`       | `string` | No       | —       | Start date for 'custom-date-range' filter in 'YYYY-MM-DD' format                                                                                                                                                                                                                                                                                    |
| `payload.enddate`         | `string` | No       | —       | End date for 'custom-date-range' filter in 'YYYY-MM-DD' format                                                                                                                                                                                                                                                                                      |
| `payload.paginationToken` | `string` | No       | —       | Pagination token from the previous response for fetching the next page Format: `nullable`.                                                                                                                                                                                                                                                          |

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

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Retrieve a list of LinkedIn Ads matching the specified search criteria.",
    "properties": {
      "searchUrl": {
        "type": "string",
        "description": "Scrape Ad Library search URL, for example: https://www.linkedin.com/ad-library/search?accountOwner=test&keyword=test&dateOption=custom-date-range&startdate=2025-07-07&enddate=2025-08-21"
      },
      "keyword": {
        "type": "string",
        "description": "Search by keyword"
      },
      "accountOwner": {
        "type": "string",
        "description": "Search by company or advertiser name"
      },
      "countries": {
        "type": "string",
        "description": "One or comma separated list of country codes to filter ads by country. Eg. 'US,GB,FR'. Supports \"ALL\" value to search in all countries."
      },
      "dateOption": {
        "type": "string",
        "description": "One of the following options to filter ads by date: 'last-30-days', 'current-month', 'current-year', 'last-year', 'custom-date-range'"
      },
      "startdate": {
        "type": "string",
        "description": "Start date for 'custom-date-range' filter in 'YYYY-MM-DD' format"
      },
      "enddate": {
        "type": "string",
        "description": "End date for 'custom-date-range' filter in 'YYYY-MM-DD' format"
      },
      "paginationToken": {
        "type": "string",
        "description": "Pagination token from the previous response for fetching the next page",
        "format": "nullable"
      }
    },
    "required": [],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

Standard tool result payload.

| Name                                      | Type                | Required | Default | Details                                        |
| ----------------------------------------- | ------------------- | -------- | ------- | ---------------------------------------------- |
| `result.data`                             | `object`            | Yes      | —       | Provider response payload.                     |
| `result.data.elements`                    | `array`             | No       | —       | —                                              |
| `result.data.pagination`                  | `object`            | No       | —       | —                                              |
| `result.data.pagination.totalPages`       | `integer`           | No       | —       | Format: `int32`.                               |
| `result.data.pagination.totalElements`    | `integer`           | No       | —       | Format: `int32`.                               |
| `result.data.pagination.pageNumber`       | `integer`           | No       | —       | Format: `int32`.                               |
| `result.data.pagination.previousElements` | `integer`           | No       | —       | Format: `int32`.                               |
| `result.data.pagination.pageSize`         | `integer`           | No       | —       | Format: `int32`.                               |
| `result.data.pagination.paginationToken`  | `string`            | No       | —       | Format: `nullable`.                            |
| `result.data.status`                      | `string \| integer` | No       | —       | —                                              |
| `result.data.error`                       | `string \| null`    | No       | —       | —                                              |
| `result.meta`                             | `object`            | No       | —       | Additional response metadata (status, paging). |

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

  ### Output JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Standard tool result payload.",
    "properties": {
      "data": {
        "type": "object",
        "description": "Provider response payload.",
        "properties": {
          "elements": {
            "type": "array",
            "items": {}
          },
          "pagination": {
            "type": "object",
            "properties": {
              "totalPages": {
                "type": "integer",
                "format": "int32"
              },
              "totalElements": {
                "type": "integer",
                "format": "int32"
              },
              "pageNumber": {
                "type": "integer",
                "format": "int32"
              },
              "previousElements": {
                "type": "integer",
                "format": "int32"
              },
              "pageSize": {
                "type": "integer",
                "format": "int32"
              },
              "paginationToken": {
                "type": "string",
                "format": "nullable"
              }
            },
            "additionalProperties": false
          },
          "status": {
            "type": [
              "string",
              "integer"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "description": "Additional response metadata (status, paging).",
        "additionalProperties": true
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `provider_usage` (provider usage).
* Estimated Deepline credits: `0.02` per pricing unit.

## Related documentation

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