# Ingest Events

URL: https://docs.nexart.io/docs/evidence-bridge/ingest-events

Send existing application JSON to a published profile with server-side authentication and a stable idempotency key, then inspect mapping, eligibility and evidence states.

## Endpoint

```
POST https://bridge.nexart.io/api/v1/ingest/{profileId}/{revision}
```

## Required headers

```
Authorization: Bearer nx_live_...
Content-Type: application/json
Idempotency-Key: your-stable-event-key
```

Keep the NexArt API key on the server. Never expose it in browser JavaScript.

## cURL

Ingest payload.json

```
curl -X POST   "https://bridge.nexart.io/api/v1/ingest/YOUR_PROFILE_ID/1"   -H "Authorization: Bearer $NEXART_API_KEY"   -H "Content-Type: application/json"   -H "Idempotency-Key: execution-run-84729"   --data-binary @payload.json
```

## JavaScript

Server-side JavaScript

```
const response = await fetch(
  "https://bridge.nexart.io/api/v1/ingest/YOUR_PROFILE_ID/1",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.NEXART_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": event.id
    },
    body: JSON.stringify(event)
  }
);

if (!response.ok) {
  throw new Error(`Bridge ingestion failed: ${response.status}`);
}

const result = await response.json();
console.log(result.resultId, result.cer?.certificateHash);
```

## Idempotency

The customer application supplies the key. NexArt does not issue it.

- Use an event, transaction, job, workflow-run or stable execution ID.
- A UUID is suitable when it is generated once and retained for retries.
- Same profile, revision, key and source payload returns the existing result.
- The same key with different source bytes is rejected as a conflict.
- Different logical events MUST use different keys.

Safe retries preserve the original result ID, CER and certificate hash.

## Result state

A response can include the result ID, source digests, profile identity and hash, provenance, validation state, evidence eligibility, selected target, CER, certificate hash, local verification and Node-attestation state. The exact response depends on mapping and eligibility.

## Common errors

- Mapping valid, evidence ineligible: inspect `missingRequiredSemantics`.
- Profile not published: production ingestion requires an immutable revision.
- Idempotency conflict: the key was used with different source bytes.
- OpenTelemetry batch rejected: send one span JSON object per request.
