---
title: "Deploy pretrained model"
method: POST
path: "/api/{projectId}/jobs/deploy-pretrained-model"
tags: ["Jobs"]
---

# Deploy pretrained model

`POST /api/{projectId}/jobs/deploy-pretrained-model`

## Request

- Base URL: `https://studio.edgeimpulse.com/v1`
- URL: `https://studio.edgeimpulse.com/v1/api/{projectId}/jobs/deploy-pretrained-model`
- 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/jobs/deploy-pretrained-model/post.ts> (a function with typed inputs; its response is checked against the schema)

Takes in a TFLite file and builds the model and SDK. Updates are streamed over the websocket API (or can be retrieved through the /stdout endpoint). Use getProfileTfliteJobResult to get the results when the job is completed.

## Path parameters

- `projectId` integer, required

## Query parameters

- `impulseId` integer

## Request body

- DeployPretrainedModelRequest
  - `modelFileBase64` string, required: A base64 encoded pretrained model
  - `modelFileType` 'tflite' | 'onnx' | 'saved_model' | 'lgbm' | 'xgboost' | 'pickle' | 'ngboost', required
  - `deploymentType` string, required: The name of the built target. You can find this by listing all deployment targets through `listDeploymentTargetsForProject` (via `GET /v1/api/{projectId}/deployment/targets`) and see the `format` type.
  - `engine` 'tflite' | 'tflite-eon' | 'tflite-eon-ram-optimized' | 'tensorrt' | 'tensaiflow' | 'drp-ai' | 'tidl' | 'akida' | 'syntiant' | 'memryx' | 'neox' | 'ethos-linux' | 'st-aton' | 'ceva-npn' | 'nordic-axon' | 'vlm-connector' | 'qaic'
  - `modelInfo` object, required
    - `input` union, required
      - DeployPretrainedModelInputTimeSeries
        - `inputType` 'time-series', required
        - `frequencyHz` number, required
        - `windowLengthMs` integer, required
      - DeployPretrainedModelInputAudio
        - `inputType` 'audio', required
        - `frequencyHz` number, required
      - DeployPretrainedModelInputImage
        - `inputType` 'image', required
        - `inputScaling` '0..1' | '-1..1' | '-128..127' | '0..255' | 'torch' | 'bgr-subtract-imagenet-mean': Normalization that is applied to images. If this is not set then 0..1 is used. "0..1" gives you non-normalized pixels between 0 and 1. "-1..1" gives you non-normalized pixels between -1 and 1. "0..255" gives you non-normalized pixels between 0 and 255. "-128..127" gives you non-normalized pixels between -128 and 127. "torch" first scales pixels between 0 and 1, then applies normalization using the ImageNet dataset (same as `torchvision.transforms.Normalize()`). "bgr-subtract-imagenet-mean" scales to 0..255, reorders pixels to BGR, and subtracts the ImageNet mean from each channel.
        - `resizeMode` 'squash' | 'fit-short' | 'fit-long' | 'crop': Input images are resized automatically before training and testing, to match the impulse input shape. This determines the resize mode used when the aspect ratio of the input data is different to the aspect ratio of the impulse.
      - DeployPretrainedModelInputOther
        - `inputType` 'other', required
    - `model` union, required
      - DeployPretrainedModelModelClassification
        - `modelType` 'classification', required
        - `labels` string[], required
        - `addSoftmax` boolean
      - DeployPretrainedModelModelRegression
        - `modelType` 'regression', required
      - DeployPretrainedModelModelObjectDetection
        - `modelType` 'object-detection', required
        - `labels` string[], required
        - `lastLayer` 'mobilenet-ssd' | 'fomo' | 'yolov2-akida' | 'yolov5' | 'yolov5v5-drpai' | 'yolox' | 'yolov7' | 'yolo-pro' | 'tao-retinanet' | 'tao-ssd' | 'tao-yolov3' | 'tao-yolov4' | 'yolov11' | 'yolov11-abs' | 'paddleocr-detector' | 'qc-face-det-lite' | 'qc-yolox', required
        - `minimumConfidence` number, required: Deprecated: use thresholdValues instead. Threshold for objects (f.e. 0.3).
        - `thresholdValues` object: All configured thresholds for the current model. Valid keys are 'min_score' (object detection models, all but paddleocr-detector); 'min_score_pixel', 'min_score_box', 'unclip_ratio' (paddleocr-detector).
      - DeployPretrainedModelModelFreeform
        - `modelType` 'freeform', required
      - DeployPretrainedModelModelAnomaly
        - `modelType` 'anomaly', required
      - DeployPretrainedModelModelVisualAnomaly
        - `modelType` 'visual-anomaly', required
        - `thresholdValues` object: All configured thresholds for the current model. Valid keys are 'min_anomaly_score' and 'anomaly_scoring_aggregation_method'.
  - `representativeFeaturesBase64` string: A base64 encoded .npy file containing the features from your validation set (optional for onnx and saved_model) - used to quantize your model.
  - `deployModelType` 'int8' | 'float32'
  - `useConverter` 'onnx-tf' | 'onnx2tf': Optional, use a specific converter (only for ONNX models).
  - `overrideInputShape` integer[]: Optional for ONNX files: overrides the input shape of the model. This is highly suggested if the model has dynamic dimensions. If this field is not set, then all dynamic dimensions will be set to '1'.

## Response `200`

OK

- StartJobResponse
  - `success` boolean, required: Whether the operation succeeded
  - `error` string: Optional error description (set if 'success' was false)
  - `id` integer, required: Job identifier. Status updates will include this identifier.

---

[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)
