Skip to content

Scratch Example cURL / Direct API Usage

Example Scratch Scripts Package

This guide walks you through downloading example shell scripts (using cURL), configuring, and verifying the Neuramancer API using direct cURL calls and bash scripts. This is a great way to understand the underlying API interactions without the abstraction.

You may want to adapt this code for a professional client-side integration in your backend or frontend application.

There are two tiers for analysis creation: flagging and forensicReporting. You can specify the tier in the options field of the input when creating an analysis. Please read and edit the 1_create-analysis.sh for this. We default to flagging tier (cheapest variant). The forensicReporting tier is more expensive, but also provides a more detailed report, including heatmaps and detailed explainability information.

Terminal window
NAIS_API_BASE_URL="https://api.neuramancer.dev" \
NAIS_TENANT_NAME="$YOUR_NAIS_TENANT_NAME" \
NAIS_API_KEY="$YOUR_NAIS_API_KEY" \
bash ./1_create-analysis.sh real.jpg 586 640

Alternatively, you can set the environment variables in an .env file. In this case, the call would look like this:

Terminal window
bash ./1_create-analysis.sh real.jpg 586 640

NOTE: For a fake test, use fake.jpg, width: 720 and height: 960.

Our backend will authenticate against our blob strorage service and create presigned upload URLs for you (the client) to upload them directly. These URLs will be printed in the JSON result that is printed (and returned by the above API call):

Example return JSON:

{
"success": true,
"data": [
{
"id": "ssdfa1712aaf6cdasd56f00de91f32345",
"tenantId": "sgd67234a38f0e35a6f5c1ed33234aa30dsf",
"projectId": null,
"tierUpgradedFrom": null,
"tierUpgradedAt": null,
"createdDate": "2026-05-27T15:50:02.757Z",
"updatedDate": null,
"createdByUserId": "sasfgdf-d3545-4d61-b95e-36edccf37a7f",
"lastChangedByUserType": "api",
"lastChangedByUserId": "ghj325<-a3sd-jhj3-b95e-3453",
"deletedDate": null,
"storageType": "azure",
"name": "real.jpg",
"type": "image",
"input": {
"version": "v1",
"format": "jpg",
"width": 586,
"height": 640,
"filename": "real.jpg",
"options": {
"model": "nais-image-latest",
"decisionStrategy": "default",
"tier": "flagging",
"seed": 1337
},
"storageUrls": {
"type": "azure",
"objectKey": "",
"putUrl": "...",
"getUrl": "...",

You can:

  1. Upload an image to the putUrl using a PUT request, for example with curl or any other HTTP client library of your choice.
  2. After the upload is complete, you can download and check the image by accessing the getUrl with a GET request (works in-browser as well).

2. Upload the image to the provided putUrl

Section titled “2. Upload the image to the provided putUrl”

The following script call will upload the image to the provided putUrl. Please replace the variable returnJson.data[0].storageUrls.putUrl with the actual URL from the JSON response.

Terminal window
bash ./2_upload-image.sh "returnJson.data[0].storageUrls.putUrl" real.jpg

For example:

Terminal window
bash ./2_upload-image.sh "https://nfblobdev.blob.core.windows.net/nf-blob-container-primary-dev/analysis-image-sdfadsaf435345<daf-dfasdfasdf43534534f<fasdf?sv=2025-01-05&st=2026-05-27T15%3A45%3A02Z&se=2036-05-27T15%3A21%3A16Z&sr=b&sp=rcw&sig=asdasddgASF%esdfasdfasdfasdf34523452345%3D" real.jpg

You can open the link provided in the getUrl field of the JSON response in your browser to check if the upload was successful.

NOTE: Beware that this URL might contain escape characters or URL encoded characters. Should you have trouble with “signature verification failed” errors, please make sure to decode the URL properly before accessing it. The simplest way is to use a browser as a tool for verification, clicking the link via a bash integration.

After the image has been uploaded, you can start the analysis process by running the following script:

Terminal window
NAIS_API_BASE_URL="https://api.neuramancer.dev" \
NAIS_TENANT_NAME="$YOUR_NAIS_TENANT_NAME" \
NAIS_API_KEY="$YOUR_NAIS_API_KEY" \
bash ./3_start_processing.sh $analysis_id

Alternatively, you can set the environment variables in an .env file. In this case, the call would look like this:

Terminal window
bash ./3_start_processing.sh $analysis_id

NOTE: Please replace $analysis_id with the actual ID of the analysis that you want to start, which is provided in the id field of the JSON response from step 1.

For example:

Terminal window
bash ./3_start_processing.sh "ssdfa1712aaf6cdasd56f00de91f32345"

You can poll the analysis status by running the following script:

Terminal window
NAIS_API_BASE_URL="https://api.neuramancer.dev" \
NAIS_TENANT_NAME="$YOUR_NAIS_TENANT_NAME" \
NAIS_API_KEY="$YOUR_NAIS_API_KEY" \
bash ./4_poll_status.sh $analysis_id

Alternatively, you can set the environment variables in an .env file. In this case, the call would look like this:

Terminal window
bash ./4_poll_status.sh $analysis_id

NOTE: Please replace $analysis_id with the actual ID of the analysis that you want to start, which is provided in the id field of the JSON response from step 1.

For example:

Terminal window
bash ./4_poll_status.sh "ssdfa1712aaf6cdasd56f00de91f32345"

The response for this call will contain the current status of the analysis, which can be one of the following:

{
"success": true,
"data": [
{
"id": "ssdfa1712aaf6cdasd56f00de91f32345",
"tenantId": "sgd67234a38f0e35a6f5c1ed33234aa30dsf",
"projectId": null,
"tierUpgradedFrom": null,
"tierUpgradedAt": null,
"createdDate": "2026-05-27T15:50:02.757Z",
"updatedDate": null,
"createdByUserId": "a6b1e6e2-d355-4d61-b95e-36edccf37a7f",
"lastChangedByUserType": "api",
"lastChangedByUserId": "a6b1e6e2-d355-4d61-b95e-36edccf37a7f",
"deletedDate": null,
"storageType": "azure",
"name": "real.jpg",
"type": "image",
"input": {
"version": "v1",
"format": "jpg",
"width": 586,
"height": 640,
"filename": "real.jpg",
"options": {
"model": "nais-image-latest",
"decisionStrategy": "default",
"tier": "flagging",
"seed": 1337
},
"storageUrls": {
"type": "azure",
"objectKey": "",
"putUrl": "...",
"getUrl": "...",
"deleteUrl": "...",
"expiresAt": "2036-05-27T15:21:16.000Z"
}
},
"inferenceStatus": {
"type": "BD",
"version": "0.3.3",
"status": "completed",
"statusMessage": "Inference completed successfully",
"retryCount": 1,
"processingStartTime": "2026-05-27T16:13:08.072Z",
"processingFinishTime": "2026-05-27T16:13:19.804Z",
"result": {
"resultClass": 0,
"resultSubClasses": [],
"predictions": null,
"classUncertainties": null,
"classSimilarities": null,
"anomaly": null,
"heatmaps": null,
"report": null
}
},
"comment": "Flagging example from sdk/example-scratch/create-analysis-real.sh",
"tags": null,
"lastChangedByUserName": null
}
],
"total": 1,
"startIndex": 0,
"endIndex": 0
}