Skip to main content
POST
/
attestations
/
{org}
/
{flow_name}
/
trail
/
{trail_name}
/
sonar
Attest Sonar scan
curl --request POST \
  --url https://app.kosli.com/api/v2/attestations/{org}/{flow_name}/trail/{trail_name}/sonar \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'data_json={
  "attestation_name": "<string>",
  "sonar_results": {
    "analysedAt": "<string>",
    "revision": "<string>",
    "project": {
      "key": "<string>",
      "url": "<string>",
      "name": ""
    },
    "serverUrl": "<string>",
    "taskId": "<string>",
    "status": "<string>",
    "changedAt": "<string>",
    "qualityGate": {
      "status": "<string>",
      "conditions": [
        {
          "metric": "<string>",
          "errorThreshold": "<string>",
          "operator": "<string>",
          "status": "<string>",
          "value": "<string>",
          "onLeakPeriod": true
        }
      ],
      "name": "<string>"
    }
  },
  "origin_url": "<string>",
  "description": "<string>",
  "artifact_fingerprint": "<string>",
  "target_artifacts": [
    "<string>"
  ],
  "git_commit_info": {
    "sha1": "<string>",
    "message": "<string>",
    "author": "<string>",
    "author_username": "<string>",
    "branch": "<string>",
    "timestamp": 123,
    "url": "<string>",
    "parents": [
      "<string>"
    ]
  },
  "repo_info": {
    "name": "<string>",
    "url": "<string>",
    "id": "<string>",
    "description": "<string>",
    "provider": "github"
  },
  "external_urls": {},
  "annotations": {},
  "user_data": {}
}' \
  --form 'attachment_file=<string>'

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

flow_name
string
required
trail_name
string
required
org
string
required

Body

multipart/form-data
data_json
SonarAttestationPostInput · object
required

Attestation data in JSON format

Example:
{
  "attestation_name": "sonar",
  "git_commit_info": {
    "author": "Jon Smith <jon@smith.com>",
    "branch": "main",
    "message": "adding glorious commit",
    "sha1": "ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6",
    "timestamp": 1750923680,
    "url": "https://github.com/org/repo/commit/ae08fc6a5c963ae8dfaa0c27d8e5de9980d433b6"
  },
  "sonar_results": {
    "analysedAt": "1724052982",
    "project": {
      "key": "xxx",
      "name": "",
      "url": "https://foo.com"
    },
    "qualityGate": {
      "conditions": [
        {
          "errorThreshold": "xx",
          "metric": "xx",
          "operator": "xx",
          "status": "OK"
        }
      ],
      "name": "gate-1",
      "status": "OK"
    },
    "revision": "649a645f2c138b7c626f2d9a33b4f3baaad1e213"
  },
  "user_data": {}
}
attachment_file
string | null

Optional attachment file (max size: 10MB)

Response

Creation Success

Last modified on April 9, 2026