> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.morphiaone.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.morphiaone.ai/_mcp/server.

# Cancel a colour Assessment

POST https://api.morphiaone.ai/v1/digitisation/assessments/{assessment_id}/cancel

No body and no `Idempotency-Key`: the operation is naturally idempotent. A
`queued` or `running` assessment is cancelled now, and a measurement already
under way writes nothing. One already cancelled answers itself; a finished one
answers `409 ASSESSMENT_NOT_CANCELLABLE`.
Requires the `digitisation.write` scope, which your account operator provisions;
served only where digitisation is enabled for your environment.

Reference: https://docs.morphiaone.ai/api-reference/endpoints/digitisation/assessments-cancel

## Authentication

- `X-API-Key` header (required) — API key for one environment of your account. Keep server-side; never expose in browser clients.

## Request

### Path parameters

- `assessment_id` (string, required)

## Response

### 200

The assessment, cancelled (now, or by an earlier request)

- `attempts` (integer, required)
- `colour_contract_version` (integer, required)
- `created_at` (datetime, required)
- `failure_code` (enum, required, nullable)
  - Allowed values: `evidence_erased`, `evidence_integrity`, `colour_contract_changed`, `attempts_exhausted`, `detection_unavailable`
- `finished_at` (datetime, required, nullable)
- `id` (string, required)
- `output` (AssessmentResultDocument, required, nullable) — The canonical result; ``result_sha256`` is its digest.
- `output_sha256` (string, required, nullable)
- `request` (AssessmentRequestDocument, required) — The canonical request; ``request_sha256`` is its digest.
- `request_sha256` (string, required)
- `started_at` (datetime, required, nullable)
- `status` (enum, required)
  - Allowed values: `queued`, `running`, `succeeded`, `failed`, `cancelled`

## Errors

### 400 Bad Request Error

Invalid request

- `error` (ErrorDetail, required)

### 401 Unauthorized Error

Missing or invalid API key

- `error` (ErrorDetail, required)

### 403 Forbidden Error

API key lacks the digitisation.write scope

- `error` (ErrorDetail, required)

### 404 Not Found Error

No such assessment

- `error` (ErrorDetail, required)

### 409 Conflict Error

The assessment already finished

- `error` (ErrorDetail, required)

### 503 Service Unavailable Error

Digitisation unavailable

- `error` (ErrorDetail, required)

## Types

### AssessmentResultDocument

The canonical result; ``result_sha256`` is its digest.

- `colour_contract_version` (integer, required)
- `images` (list of AssessmentImageResult, required)
- `kind` ("digitisation.assessment_result", required)
- `request_sha256` (string, required)

### AssessmentRequestDocument

The canonical request; ``request_sha256`` is its digest.

- `colour_contract_version` (integer, required)
- `images` (list of AssessmentRequestImage, required)
- `kind` ("digitisation.assessment_request", required)
- `subject` (SubjectDocument, optional) — A subject as recorded: only the fields that were sent.

### ErrorDetail

- `code` (string, required)
- `message` (string, required)
- `request_id` (string, required)
- `details` (ErrorDetailDetails, optional)
- `doc_url` (string, optional, nullable)
- `retryable` (boolean, optional, nullable)

### AssessmentImageResult

- `analyzed_bytes_sha256` (string, required)
- `evidence_id` (string, required)
- `regions` (list of map from string to any, required)
- `detection` (RegionDetection, optional) — How an ``"auto"`` image's region was found. ``detected`` is the model's box and ``region`` the even window measured inside it, both in stored-image pixels; null when nothing measurable was found, and ``reasons`` says why. The model never names a colour: the region's report is the colour contract's. ``model``, ``photo_type`` and ``confidence`` are null only when no model was asked (``reasons`` then holds the colour contract's code for an image it refuses).

### AssessmentRequestImage

An image as the request recorded it: its id bound to the measured bytes.

- `analyzed_bytes_sha256` (string, required)
- `evidence_id` (string, required)
- `regions` (AssessmentRequestImageRegions, required)

### SubjectDocument

A subject as recorded: only the fields that were sent.

- `brand` (string, optional)
- `external_ref` (string, optional)
- `gtin` (string, optional)
- `product_name` (string, optional)
- `shade_name` (string, optional)

### ErrorDetailDetails

- map from string to any
- list of map from string to any

### RegionDetection

How an ``"auto"`` image's region was found. ``detected`` is the model's box and ``region`` the even window measured inside it, both in stored-image pixels; null when nothing measurable was found, and ``reasons`` says why. The model never names a colour: the region's report is the colour contract's. ``model``, ``photo_type`` and ``confidence`` are null only when no model was asked (``reasons`` then holds the colour contract's code for an image it refuses).

- `confidence` (double, required, nullable)
- `detected` (list of integer, required, nullable)
- `model` (string, required, nullable)
- `photo_type` (enum, required, nullable)
  - Allowed values: `swatch`, `packshot`, `model`, `box_art`, `other`
- `reasons` (list of string, required)
- `region` (list of integer, required, nullable)

### AssessmentRequestImageRegions

- list of list of integer
- "auto"

## Examples

**Response**

```json
{
  "attempts": 0,
  "colour_contract_version": 1,
  "created_at": "2026-10-22T03:19:40.271273Z",
  "failure_code": null,
  "finished_at": "2026-10-22T03:19:40.273715Z",
  "id": "assessment_4p8ha07gfz5pw5e6mg9ye038tp",
  "output": null,
  "output_sha256": null,
  "request": {
    "colour_contract_version": 1,
    "images": [
      {
        "analyzed_bytes_sha256": "802a63709b9b3660da4dd729a944279d93b7589b3e441ed02e76f8bef05f7038",
        "evidence_id": "evidence_4jvaws4n7vkx8t6tz6awjwdsv8",
        "regions": [
          [
            0,
            0,
            32,
            32
          ]
        ]
      }
    ],
    "kind": "digitisation.assessment_request"
  },
  "request_sha256": "37b5394d76fc018987a7bddb12216429ac8ae9cbe47aa1a25ee5f05d94feba91",
  "started_at": null,
  "status": "cancelled"
}
```

**SDK Code**

```python Digitisation_assessmentsCancel_example
import requests

url = "https://api.morphiaone.ai/v1/digitisation/assessments/assessment_id/cancel"

headers = {"X-API-Key": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Digitisation_assessmentsCancel_example
const url = 'https://api.morphiaone.ai/v1/digitisation/assessments/assessment_id/cancel';
const options = {method: 'POST', headers: {'X-API-Key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Digitisation_assessmentsCancel_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.morphiaone.ai/v1/digitisation/assessments/assessment_id/cancel"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("X-API-Key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Digitisation_assessmentsCancel_example
require 'uri'
require 'net/http'

url = URI("https://api.morphiaone.ai/v1/digitisation/assessments/assessment_id/cancel")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Digitisation_assessmentsCancel_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.morphiaone.ai/v1/digitisation/assessments/assessment_id/cancel")
  .header("X-API-Key", "<apiKey>")
  .asString();
```

```php Digitisation_assessmentsCancel_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.morphiaone.ai/v1/digitisation/assessments/assessment_id/cancel', [
  'headers' => [
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Digitisation_assessmentsCancel_example
using RestSharp;

var client = new RestClient("https://api.morphiaone.ai/v1/digitisation/assessments/assessment_id/cancel");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Digitisation_assessmentsCancel_example
import Foundation

let headers = ["X-API-Key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.morphiaone.ai/v1/digitisation/assessments/assessment_id/cancel")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```