> For the complete documentation index, see [llms.txt](https://doc.keepnetlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.keepnetlabs.com/api-reference/reseller/phishing-simulation/start-phishing-simulation-for-customer.md).

# Start phishing simulation for a customer

As a Reseller you can create a phishing campaign for a customer and immediately start it so the simulation emails go out to target users. The flow: get the customer's Company ID, pick a scenario and target group, create the campaign, then start the campaign job. Use a credential with Client Role = **Reseller**. Send **`X-KEEPNET-Company-Id`** with every request.

***

## POST /api/companies/search

> Get the customer's Company ID first. Use the `resourceId` from the response as **`X-KEEPNET-Company-Id`** in all subsequent requests. **Test it:** Authorize with Client ID/Secret, then Send — request body is pre-filled.

{% openapi src="/files/YqgEnchxXuSVklhH9GGT" path="/api/companies/search" method="post" expanded="true" %}
[keepnet-api-spec.json](https://3453589210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LMcQ_WCXOrHv3r05ae5%2Fuploads%2Fgit-blob-31c738c1a6bb3d2911bd3730c780d6ad7fa6bbad%2Fkeepnet-api-spec.json?alt=media)
{% endopenapi %}

***

## POST /api/phishing-simulator/phishing-scenario/search

> List phishing scenarios available for the customer. Send **`X-KEEPNET-Company-Id`**. Pick a scenario and note its `resourceId` — use it as `phishingScenarioResourceIds` in the campaign body.

{% openapi src="/files/YqgEnchxXuSVklhH9GGT" path="/api/phishing-simulator/phishing-scenario/search" method="post" expanded="true" %}
[keepnet-api-spec.json](https://3453589210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LMcQ_WCXOrHv3r05ae5%2Fuploads%2Fgit-blob-31c738c1a6bb3d2911bd3730c780d6ad7fa6bbad%2Fkeepnet-api-spec.json?alt=media)
{% endopenapi %}

***

## POST /api/target-groups/search/current-company

> List target groups for the customer. Send **`X-KEEPNET-Company-Id`**. Use one or more `resourceId` values as `targetGroupResourceIds` in the campaign body.

{% openapi src="/files/YqgEnchxXuSVklhH9GGT" path="/api/target-groups/search/current-company" method="post" expanded="true" %}
[keepnet-api-spec.json](https://3453589210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LMcQ_WCXOrHv3r05ae5%2Fuploads%2Fgit-blob-31c738c1a6bb3d2911bd3730c780d6ad7fa6bbad%2Fkeepnet-api-spec.json?alt=media)
{% endopenapi %}

***

## GET /api/phishing-simulator/phishing-campaign/form-details

> Returns dropdown and reference data (email delivery settings, schedule types, etc.) needed to build the campaign. Send **`X-KEEPNET-Company-Id`**.

{% openapi src="/files/YqgEnchxXuSVklhH9GGT" path="/api/phishing-simulator/phishing-campaign/form-details" method="get" expanded="true" %}
[keepnet-api-spec.json](https://3453589210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LMcQ_WCXOrHv3r05ae5%2Fuploads%2Fgit-blob-31c738c1a6bb3d2911bd3730c780d6ad7fa6bbad%2Fkeepnet-api-spec.json?alt=media)
{% endopenapi %}

***

## POST /api/phishing-simulator/phishing-campaign

> Creates a new phishing campaign for the customer. Send **`X-KEEPNET-Company-Id`**. Body: `name` (required), `scheduleTypeId` (required), `phishingScenarioResourceIds`, `targetGroupResourceIds`, duration, distribution, and email delivery settings. See Endpoints → **PhishingCampaign** for the full schema.

{% openapi src="/files/YqgEnchxXuSVklhH9GGT" path="/api/phishing-simulator/phishing-campaign" method="post" expanded="true" %}
[keepnet-api-spec.json](https://3453589210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LMcQ_WCXOrHv3r05ae5%2Fuploads%2Fgit-blob-31c738c1a6bb3d2911bd3730c780d6ad7fa6bbad%2Fkeepnet-api-spec.json?alt=media)
{% endopenapi %}

Example body (minimal — send immediately):

```json
{
  "name": "Q1 Phishing Simulation",
  "scheduleTypeId": 1,
  "phishingScenarioResourceIds": ["<scenarioResourceId>"],
  "targetGroupResourceIds": ["<targetGroupResourceId>"],
  "duration": 7,
  "distributionTypeId": 1,
  "distributionDelayEvery": 0,
  "distributionDelayTimeTypeId": 1,
  "sendingLimit": 0,
  "emailDeliverySettingType": 1,
  "excludeFromReports": false,
  "sendOnlyActiveUsers": true
}
```

From the response, note the campaign `resourceId`. Use it in the next step.

***

## POST /api/phishing-simulator/phishing-campaign-job/start/{resourceId}

> Starts the campaign — emails go out to target users. Replace `{resourceId}` with the campaign ID from the create response. Send **`X-KEEPNET-Company-Id`**. Body: `scheduleTypeId`, `targetGroupResourceIds`, and optional distribution config.

{% openapi src="/files/YqgEnchxXuSVklhH9GGT" path="/api/phishing-simulator/phishing-campaign-job/start/{resourceId}" method="post" expanded="true" %}
[keepnet-api-spec.json](https://3453589210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LMcQ_WCXOrHv3r05ae5%2Fuploads%2Fgit-blob-31c738c1a6bb3d2911bd3730c780d6ad7fa6bbad%2Fkeepnet-api-spec.json?alt=media)
{% endopenapi %}

Example body (start immediately):

```json
{
  "scheduleTypeId": 1,
  "targetGroupResourceIds": ["<targetGroupResourceId>"],
  "excludeFromReports": false,
  "sendingLimit": 0,
  "distributionDelayEvery": 0,
  "distributionDelayTimeTypeId": 1,
  "useTargetUserTimeZone": false
}
```

***

## Common errors

* **403 Forbidden** — Credential is not Reseller, or the Company ID is not one you manage. Set Client Role = **Reseller**. [Roles and permissions →](/next-generation-product/platform/company/system-users/user-roles.md)
* **401 Unauthorized** — Missing or invalid token. Request a new token via `POST /connect/token`.
* **400 Bad Request** — Invalid request body (missing scenario, target group, or schedule). Verify IDs from the search endpoints above; check Endpoints → **PhishingCampaign** for the full schema.
* **404 Not Found** — Invalid Company ID, scenario ID, or campaign ID.

{% hint style="info" %}
**Platform UI:** Create phishing campaigns under **Phishing Simulator → Campaign Manager**. [Campaign Manager →](/next-generation-product/platform/phishing-simulator/phishing-campaign-manager.md)
{% endhint %}

**Related:** [Create and start phishing campaign for a customer →](/api-reference/reseller/phishing-simulation/create-and-start-phishing-campaign-for-customer.md) (compact version). [List phishing scenarios for a customer →](/api-reference/reseller/phishing-simulation/list-phishing-scenarios-for-customer.md). [View customer's campaign list and report →](/api-reference/reseller/phishing-simulation/view-customer-simulation-campaign-list-and-report.md). [Scope API requests to a customer →](/api-reference/reseller/companies/scope-api-requests-to-customer.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.keepnetlabs.com/api-reference/reseller/phishing-simulation/start-phishing-simulation-for-customer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
