---
title: "Classify an image"
method: POST
path: "/api/{projectId}/classify/image"
tags: ["Classify"]
---

# Classify an image

`POST /api/{projectId}/classify/image`

## Request

- Base URL: `https://studio.edgeimpulse.com/v1`
- URL: `https://studio.edgeimpulse.com/v1/api/{projectId}/classify/image`
- Auth: one of:
  - API key in header `x-api-key`
  - API key in cookie `jwt`
  - API key in header `x-jwt-token`
  - OAuth 2
    - Authorization code: `/v1/oauth/authorize`
    - Client credentials
    - Implicit: `/v1/oauth/authorize`
    - Password
    - Token URL: `/v1/oauth/token`
- TypeScript: <https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/docs/api/:projectId/classify/image/post.ts> (a function with typed inputs; its response is checked against the schema)

Test out a trained impulse (using a posted image).

## Path parameters

- `projectId` integer, required

## Query parameters

- `impulseId` integer

## Request body `multipart/form-data`

- UploadImageRequest
  - `image` string, binary, required

## Response `200`

OK

- TestPretrainedModelResponse
  - `success` boolean, required: Whether the operation succeeded
  - `error` string: Optional error description (set if 'success' was false)
  - `result` object: Classification value per label. For a neural network this will be the confidence, for anomalies the anomaly score.
  - `boundingBoxes` BoundingBoxWithScore[]
    - `label` string, required
    - `x` number, required
    - `y` number, required
    - `width` number, required
    - `height` number, required
    - `score` number, required
  - `freeformResult` object
    - `outputTensors` object[], required
      - `shape` integer[], required
      - `dataType` 'int8' | 'uint8' | 'float32', required
      - `data` number[], required
  - `anomalyResult` AnomalyResult[]: Anomaly scores and computed metrics for visual anomaly detection, one item per window.
    - `boxes` BoundingBoxWithScore[]: For visual anomaly detection. An array of bounding box objects, (x, y, width, height, score, label), one per detection in the image. Filtered by the minimum confidence rating of the learn block.
      - `label` string, required
      - `x` number, required
      - `y` number, required
      - `width` number, required
      - `height` number, required
      - `score` number, required
    - `scores` array[]: 2D array of shape (n, n) with raw anomaly scores for visual anomaly detection, where n can be calculated as ((1/8 of image input size)/2 - 1). The scores corresponds to each grid cell in the image's spatial matrix.
      - number[]
    - `meanScore` number: Mean value of the scores.
    - `maxScore` number: Maximum value of the scores.

---

[API](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api.md) - [All operations](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/llms.txt) - [OpenAPI document](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/revisions/e2a976d38427?raw)
