> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/release-orchestration/use-release-orchestration/release-orchestration-artifacts/webhook-signal-api.md).

# Ingest Artifacts with the Webhook Signal API

Ingest CI-produced container images into the artifact tracker using the webhook signal API.

For a multi-component release, each component is often built by its own pipeline, and some of those pipelines run outside Harness or need to report an artifact asynchronously. The webhook signal API lets any such build system report a container image directly to Artifact Tracker, as an alternative to the Publish Events step described in [Get started with Artifact Tracker and Changesets](https://developer.harness.io/release-orchestration/use-release-orchestration/release-orchestration-artifacts/artifact-tracker-getting-started.md).

### What you will learn from this topic <a href="#what-you-will-learn-from-this-topic" id="what-you-will-learn-from-this-topic"></a>

* How the required [headers](#headers) authenticate a signal request
* How the [request body](#request-body) is structured for pipeline scope, event metadata, and images
* How Release Management matches an ingested image to a service mapping, described under [request body](#request-body)
* How to interpret each [response](#responses)
* How to call the API using the [cURL examples](#curl-examples)

### Before you begin <a href="#before-you-begin" id="before-you-begin"></a>

You need the following before you call the webhook signal API:

* **Service mapping**: Create a service mapping for each component before you call the API. Release Management uses the mapping to match the ingested artifact to a Harness CD service, and a signal with no matching mapping does not get ingested. Go to [Map your services](https://developer.harness.io/release-orchestration/use-release-orchestration/release-orchestration-artifacts/artifact-tracker-getting-started.md#map-your-services) to create one.
* **Account identifier**: You need your Harness account identifier to send as the `Harness-Account` header. To find your Harness Account ID, navigate to **Account Settings**, then select **Overview**. Your account ID is also visible in your browser URL: `app.harness.io/ng/account/<YOUR_ACCOUNT_ID>/...`.
* **Authentication**: You need a bearer token or an `x-api-key`, depending on how your gateway authenticates requests.

***

### Endpoint <a href="#endpoint" id="endpoint"></a>

The webhook signal API exposes the following endpoint:

| Method | Path                     | `eventType`               |
| ------ | ------------------------ | ------------------------- |
| `POST` | `/api/v1/webhook/signal` | `ARTIFACT_TRACKER_SIGNAL` |

***

### Headers <a href="#headers" id="headers"></a>

Every signal request requires the following headers:

| Header              | Required      | Description                                                                                                                                                     |
| ------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Harness-Account`   | Yes           | Account identifier.                                                                                                                                             |
| `X-Idempotency-Key` | Yes           | Unique key per signal (max 512 characters). Reuse returns the existing signal instead of creating a duplicate.                                                  |
| `Content-Type`      | Yes           | `application/json`                                                                                                                                              |
| `Authorization`     | Env-dependent | Bearer token when calling through an authenticated gateway. Some gateways accept `x-api-key` instead, following the standard Harness API authentication header. |

***

### Request body <a href="#request-body" id="request-body"></a>

The request body has the following top-level fields:

| Field       | Type     | Required | Description                                                                                      |
| ----------- | -------- | -------- | ------------------------------------------------------------------------------------------------ |
| `eventType` | `string` | Yes      | Must be `"ARTIFACT_TRACKER_SIGNAL"`.                                                             |
| `pipeline`  | `object` | Yes\*    | Pipeline scope used to resolve org/project and match releases. \*Required for successful ingest. |
| `metadata`  | `object` | Yes      | Event metadata. May be `{}`. Max 10 KiB.                                                         |
| `artifacts` | `object` | Yes†     | Images to ingest. †Or provide `metadata.artifacts_json` instead.                                 |

**`pipeline`**

All fields are required when a `pipeline` is present.

| Field         | Type     | Description                    |
| ------------- | -------- | ------------------------------ |
| `orgId`       | `string` | Organization identifier.       |
| `projectId`   | `string` | Project identifier.            |
| `identifier`  | `string` | Pipeline identifier.           |
| `executionId` | `string` | Pipeline execution identifier. |

Find these values in the pipeline's URL and YAML, or resolve them automatically when a Harness pipeline triggers the signal, using the expressions `<+org.identifier>`, `<+project.identifier>`, `<+pipeline.identifier>`, and `<+pipeline.executionId>`. Go to [Harness variables](https://developer.harness.io/harness-platform/use-harness-platform/variables-and-expressions/harness-variables).

{% hint style="info" %}
**Scope resolution**

`orgId` and `projectId` must resolve to the same scope as the service mapping, or to a scope nested under it. Harness resolves scope using standard inheritance: a project inherits from its organization, and an organization inherits from its account. For example, a service mapping created at the organization scope matches a signal reported from a pipeline in any project within that organization.
{% endhint %}

**`metadata`**

| Key                 | Required | Description                                                                            |
| ------------------- | -------- | -------------------------------------------------------------------------------------- |
| `commit_sha`        | No       | Latest Git commit SHA for the build.                                                   |
| `repo_name`         | No       | Repository name, for example `acme/api`.                                               |
| `branch`            | No       | Git branch.                                                                            |
| `git_connector_ref` | No       | Git connector override for changeset resolution.                                       |
| `git_provider_type` | No       | Git provider type.                                                                     |
| `artifacts_json`    | No       | JSON string of an `artifacts` payload when the top-level `artifacts` field is not set. |

**`artifacts.images[]`**

| Field       | Type     | Required | Description                                                                                                         |
| ----------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
| `imageName` | `string` | Yes      | Image reference, for example `gcr.io/acme/api`. The registry and path must match a service mapping when one exists. |
| `tag`       | `string` | Yes      | Image tag, for example `v1.0.0`.                                                                                    |
| `url`       | `string` | No       | Full image URL. Helps recover the registry when `imageName` has no host.                                            |
| `digest`    | `string` | No       | Image digest.                                                                                                       |

{% hint style="info" %}
**Service mapping matching**

`imageName` `gcr.io/acme/api` is matched to the registry `gcr.io` and path `acme/api`, using the account, organization, and project resolved from the headers and `pipeline`. If a mapping exists, Release Management links the artifact to it and may compute a changeset when a Git resolution is available. Without a mapping, Release Management still stores the artifact.
{% endhint %}

***

### Responses <a href="#responses" id="responses"></a>

The API returns one of the following responses:

| HTTP  | `status`             | Meaning                                |
| ----- | -------------------- | -------------------------------------- |
| `202` | `accepted`           | Signal accepted and queued.            |
| `200` | `already_processing` | Same `X-Idempotency-Key` already used. |
| `400` | None                 | Invalid request.                       |
| `413` | None                 | Payload too large.                     |

A successful response returns:

{% code title="202 Accepted" overflow="wrap" %}

```json
{
  "webhookId": "<id>",
  "status": "accepted"
}
```

{% endcode %}

***

### Verify the ingested artifact <a href="#verify-the-ingested-artifact" id="verify-the-ingested-artifact"></a>

A successful signal adds a new row to Artifact Explorer, with the artifact path, tag, registry, mapped service, and triggering build execution.

<figure><img src="https://478177610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwRDYqBolZUj6Rwnqx0mm%2Fuploads%2Fgit-blob-58f0cb76b739f2a362e740097ba58ae210bbb194%2Fartifact-explorer-webhook-signal-result.png?alt=media" alt="Artifact Explorer showing an artifact ingested through the webhook signal API"><figcaption><p>Artifact Explorer after a successful signal</p></figcaption></figure>

Go to [View artifact catalog and changesets](https://developer.harness.io/release-orchestration/use-release-orchestration/release-orchestration-artifacts/artifact-tracker-getting-started.md#view-artifact-catalog-and-changesets) to filter and inspect ingested artifacts in detail.

***

### cURL examples <a href="#curl-examples" id="curl-examples"></a>

Set the following variables before running either example:

```bash
BASE_URL="http://localhost:3021"   # or https://<host>/gateway/rmg
ACCOUNT_ID="<account-id>"
TOKEN="<token>"
IDEMPOTENCY_KEY="artifact-$(date +%s)"
```

**Ingest an image**

```bash
curl -sS -X POST "${BASE_URL}/api/v1/webhook/signal" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Harness-Account: ${ACCOUNT_ID}" \
  -H "X-Idempotency-Key: ${IDEMPOTENCY_KEY}" \
  -H "Authorization: Bearer ${TOKEN}" \
  -d '{
    "eventType": "ARTIFACT_TRACKER_SIGNAL",
    "pipeline": {
      "orgId": "default",
      "projectId": "my_project",
      "identifier": "build_pipeline",
      "executionId": "exec-abc123"
    },
    "metadata": {
      "commit_sha": "abc123def456",
      "repo_name": "acme/api",
      "branch": "main"
    },
    "artifacts": {
      "images": [
        {
          "imageName": "gcr.io/acme/api",
          "tag": "v1.0.0",
          "url": "gcr.io/acme/api:v1.0.0"
        }
      ]
    }
  }'
```

**Use metadata artifacts instead of top-level artifacts**

```bash
curl -sS -X POST "${BASE_URL}/api/v1/webhook/signal" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Harness-Account: ${ACCOUNT_ID}" \
  -H "X-Idempotency-Key: ${IDEMPOTENCY_KEY}" \
  -H "Authorization: Bearer ${TOKEN}" \
  -d '{
    "eventType": "ARTIFACT_TRACKER_SIGNAL",
    "pipeline": {
      "orgId": "default",
      "projectId": "my_project",
      "identifier": "build_pipeline",
      "executionId": "exec-abc123"
    },
    "metadata": {
      "commit_sha": "abc123def456",
      "repo_name": "acme/api",
      "branch": "main",
      "artifacts_json": "{\"images\":[{\"imageName\":\"gcr.io/acme/api\",\"tag\":\"v1.0.0\"}]}"
    }
  }'
```

***

### Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

These entries map each non-success response from the [Responses](#responses) table to the part of the request to check.

<details>

<summary>The request returns 400 Invalid request</summary>

Check that every required header is present, including `Harness-Account` and `X-Idempotency-Key`, that `Content-Type` is `application/json`, and that `eventType` is `"ARTIFACT_TRACKER_SIGNAL"`. The body must include `metadata` and either `artifacts` or `metadata.artifacts_json`.

</details>

<details>

<summary>The request returns 413 Payload too large</summary>

The `metadata` object is limited to 10 KiB. Reduce what you send in `metadata`, or split the artifacts across separate signals, each with its own `X-Idempotency-Key`.

</details>

<details>

<summary>The request returns 200 already_processing</summary>

The `X-Idempotency-Key` was already used, so the API returned the existing signal instead of creating a new one. Send a new, unique key for each new signal.

</details>

***

### Next steps <a href="#next-steps" id="next-steps"></a>

* [Get started with Artifact Tracker and Changesets](https://developer.harness.io/release-orchestration/use-release-orchestration/release-orchestration-artifacts/artifact-tracker-getting-started.md): Learn the Publish Events step and the rest of the artifact tracking workflow this API complements.
* [Map your services](https://developer.harness.io/release-orchestration/use-release-orchestration/release-orchestration-artifacts/artifact-tracker-getting-started.md#map-your-services): Create the service mappings a signal needs to resolve a changeset.
* [View artifact catalog and changesets](https://developer.harness.io/release-orchestration/use-release-orchestration/release-orchestration-artifacts/artifact-tracker-getting-started.md#view-artifact-catalog-and-changesets): Confirm an ingested artifact appears and resolves to the correct changeset.

{% @harness-feedback/feedback %}
