# Signed reports: the format of version 1

Version **2.2.0** of the instructions. This page is optional. The short method is at https://creationloop.ai/connect.md.
An owner whose systems can make Ed25519 signatures can sign each report themselves, in the format below.
A signed report carries a signature and never the key that made it.
The receipt reads the same for both ways of reporting. CreationLoop does not check who holds a key.
Any system that can sign can use this format. No file from CreationLoop is needed.

## The key

1. Make an Ed25519 key pair in the place where the reports are signed. The private key stays there.
2. On the setup page, give the public key in `SPKI` PEM form and the date on which the key ends. Approve it with a passkey.
3. The setup page then shows a challenge in Base64. Decode it. The bytes are one flat JSON object.
4. Check the challenge by the list below. Sign its exact decoded bytes, and give the signature in Base64 on the setup page.
5. The challenge ends 5 minutes after the approval. After that, approve the same public key again.

The key ID is the word `reporting_` followed by the SHA-256 of the public key in `SPKI` `DER` form, as 64 lower case hex characters.

A challenge is signed only when every line of this list holds.
- `v` is the number 1.
- `purpose` is `creationloop-reporting-key-possession`.
- `issuer` is `urn:creationloop:agent-receipts:production:v1`.
- `audience` is `urn:creationloop:agent-receipts:reporting-key-activation:v1`.
- `workspaceId`, `projectId` and `agentId` are the three IDs that the setup page shows.
- `keyId` is the key ID of your public key, and `fingerprint` is the same value with no word in front of it.
- `challengeId` and `nonce` are there, and `expiresAt` is a time that has not passed.
- The object holds no other field, and no field twice.

## A report

The next four lines are the request line and the three headers of every signed report.
```text
POST https://events.creationloop.ai/v1/events
Content-Type: application/json
X-CL-Key-Id: <key ID>
X-CL-Signature: <signature>
```
- The body is one flat JSON object in `UTF-8`, of at most 2,048 bytes. No field comes twice, and unknown fields are refused.
- The signature is the Ed25519 signature of the exact body bytes. It is 64 bytes, sent in Base64 with padding, 88 characters.
- A report holds fingerprints only. This format has no field for text, and a delivered end needs a fingerprint of the output.

Every report holds these five fields.
- `v` is the number 1.
- `type` is `start`, `marker`, `end` or `outcome`.
- `at` is the time in UTC with milliseconds, in the form of the test vectors below. It is at most 5 minutes ahead of the arrival.
- `loopId` is the ID of the Loop, which the setup page shows.
- `runId` is the run ID, 1 to 128 characters from letters, digits, dot, underscore, colon and dash.

A start also holds these fields.
- `loopVersion` is the number of the saved gate version.
- `seq` is the number 0, and `prevHash` is null.
- `inputSha256` is the fingerprint of the input. `agentVersion` is optional.

A gate report has the type `marker`. It also holds these fields.
- `loopVersion`, as in the start.
- `seq` is one more than in the report before.
- `prevHash` is the SHA-256 of the exact body bytes of the report before.
- `markerId` is the ID of the gate. `artifactSha256` is optional.

An end also holds these fields.
- `loopVersion`, `seq` and `prevHash`, as in a gate report.
- `status` is `delivered` or `failed`.
- `outputSha256` is the fingerprint of the output. A delivered end needs it.
- `knownCostCents` is optional. It is a whole number of cents, zero or more.

An outcome is a later report about a run. It holds no `loopVersion`, `seq` or `prevHash`.
- `outcomeId` is a new ID for this outcome.
- `outputSha256` is the fingerprint of the output that the end reported.
- `metricId` names a metric of the saved Loop version. A report for any other metric is refused.
- `value` is a number, or true or false, as the metric says.

## Order, waits and resends

1. Send the reports of one run one at a time, in the order of `seq`.
2. Wait up to 30 seconds for an answer.
3. With no answer, or a 429 or a 503, send the same bytes again, with the same signature and the same key ID.
4. Wait first for the seconds in the header `Retry-After`, if the answer has it. If not, wait 2, then 4, then 8 seconds.
5. Make at most 4 tries in all. Never resend after any other 4xx.
6. Reporting never stops or changes the job.

## Answers

- **201** means recorded. The body holds `messageId`, `receiptId` and `recordedAt`.
- **200** means the same bytes were recorded before. The body is the first answer.
- **400** means the report is wrong. The body holds a code, and it names the field when one field is wrong.
- **401** means the signature or the key ID is wrong. The code is `invalid_signature`.
- **403** means the key cannot report here. The code is `key_not_active` or `key_out_of_scope`.
- **409** means this place in the run holds other bytes. The code is `message_conflict`, and the earlier report is marked as conflicting.
- **413** means the body is larger than 2,048 bytes.
- **429** and **503** mean too many reports, or busy. Wait, then send the same bytes again.

## The seal, and the field `customerSignature`

CreationLoop seals each report on arrival. The seal is signed by CreationLoop and names the seal before it.
The seal holds the SHA-256 of the report body in `messageSha256`, the key ID in `keyId`, and a signature in `customerSignature`.

- The field `customerSignature` holds the Ed25519 signature of the exact body bytes, made with the reporting key.
- For a signed report, it is the value of the signature header, as it was sent.
- For a report made with a key call, CreationLoop writes the body from the call and signs it. The seal then also holds `reportedWith` with the value `key`.
- CreationLoop makes that signature with the signing key it derives from the key in the call.
- The name of the field is older than the key calls. It does not say who holds the key.

The signing key of a key that starts with `clk_` is derived in one step.
Its 32 byte Ed25519 seed is the SHA-256 of the line below, then one line feed, then the whole key.
`creationloop reporting key v1`

Anyone who holds a reporting key can so check each `customerSignature` of its reports against the public key.

## Test vectors

The vectors use the public test key of RFC 8032, section 7.1, test 1. Its private half is printed in that document.
Never register this key. Anyone can sign with it.

The public key, as 32 bytes in hex, is on the next line.
`d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a`

The same public key in `SPKI` PEM form is the next three lines.
```text
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=
-----END PUBLIC KEY-----
```

The key ID of this public key is on the next line.
`reporting_06e3fd8fda29bb60ab59557de61edb0aecdb231134be30e75b455f8e1b792fa9`

The first report is a start. Its body is the next line, 228 bytes with no line feed at the end.
```json
{"v":1,"type":"start","at":"2026-11-27T17:02:00.000Z","loopId":"loop-example","runId":"20261127T1702-k7qz","loopVersion":2,"seq":0,"prevHash":null,"inputSha256":"2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"}
```
The SHA-256 of that body is the first line below, and its signature in Base64 is the second line.
```text
fbd77de67ea8e70616e59c7bef06aff962e86f20215bbbb7d3868b83f0e937be
2XBiqmpP3hT6wAWpr1ptCdvowMRKLs6YIIyF9Ur5lEcLGIwuovaA/LLs9/R97gkqoNpR+Aa9peWhhKUf4yubAA==
```

The second report is a gate report. Its body is the next line, 237 bytes with no line feed at the end.
```json
{"v":1,"type":"marker","at":"2026-11-27T17:02:01.000Z","loopId":"loop-example","runId":"20261127T1702-k7qz","loopVersion":2,"seq":1,"prevHash":"fbd77de67ea8e70616e59c7bef06aff962e86f20215bbbb7d3868b83f0e937be","markerId":"draft-written"}
```
The SHA-256 of that body is the first line below, and its signature in Base64 is the second line.
```text
951c2b189a6d93efa4de5d143b9be09dba3198c7ee63b9f09c41077b91da5fd7
IPf2XMb8wiV0ICWaQwjebKEo4axxc53wAS9fRLXGYpHy+FeSum3YOw7CC/8OH6jPQroPo6cPH4xwVBHb4LwsAQ==
```

The third report is a delivered end. Its body is the next line, 310 bytes with no line feed at the end.
```json
{"v":1,"type":"end","at":"2026-11-27T17:02:02.000Z","loopId":"loop-example","runId":"20261127T1702-k7qz","loopVersion":2,"seq":2,"prevHash":"951c2b189a6d93efa4de5d143b9be09dba3198c7ee63b9f09c41077b91da5fd7","status":"delivered","outputSha256":"486ea46224d1bb4fb680f34f7c9ad96a8f24ec88be73ea8e5a6c65260e9cb8a7"}
```
The SHA-256 of that body is the first line below, and its signature in Base64 is the second line.
```text
c5604e88add4d02e9bc4fbc39f2e76c71bfa59a9dcd322e56f1b1969babbe3a0
e4Qni31t6kDTi0o4Ilsf4f8cW3eDNhaWIYV0vP2UDrrcxz64MDxLoDhqykWY7ohY2YJAwm4fvnStF53UX8mjCA==
```

The input fingerprint in the start is the SHA-256 of the five bytes of the word hello, in lower case.
The output fingerprint in the end is the SHA-256 of the five bytes of the word world, in lower case.
A signer is right when it makes the same three signatures from the same bytes. Ed25519 signatures do not vary.

## Versions

This page is part of version 2.2.0. Its permanent copy and the checksums of this version are at the two addresses below.
- `https://creationloop.ai/connect/v2.2.0/signed.md`
- `https://creationloop.ai/connect/v2.2.0/SHA256SUMS`
