---
parent: /workflows/agents.md
back_out_url: /workflows/agents.md
---

# Workflow 5: Upload AI/ML Model to LEM

> You are at https://api.litmus.io/workflows/upload-ml-model-lem.md
> Parent: https://api.litmus.io/workflows/agents.md
> If this is the wrong workflow, back out to the index above.

## 5. Upload AI/ML Model to LEM

**UI trigger**: LEM -> Edge Lifecycle Management -> AI/ML Models -> *Upload New Model*

> LEM uses a **pre-signed S3 URL** pattern instead of the LE resumable-session pattern. Step 1 gets a signed URL; Step 2 uploads directly to object storage; Step 3 registers the model in LEM.

### Step table

| Step | Name in Collection | Method | Endpoint | Body / Notes | Output |
|------|-------------------|--------|----------|-------------|--------|
| 1 | Step 1 of Upload New AI/ML Model | `POST` | `{{LEM_URL}}/api/v1/file/{{project_id}}/mlModel/{{filename}}/upload-url` | `{"projectId": "...", "fileName": "model.zip"}` | `{"url": "<signed_s3_url>"}` |
| 2 | Step 2 of Upload New AI/ML Model | `PUT` | `{signed_s3_url from Step 1}` | Binary `.zip` model file bytes. URL contains AWS SigV4 query params. | 200 OK (S3 direct upload) |
| 3 | Step 3 of Upload New Model | `POST` | `{{LEM_URL}}/api/v1/file/{{project_id}}/mlModel/{{filename}}` | `{"description": "..."}` - commits/registers the model in LEM | Model available in LEM |

**Auth note**: Steps 1 and 3 use `X-AuthToken: {{LEM_AdminApiToken}}`. Step 2 (S3 PUT) uses the embedded AWS SigV4 signature in the URL - **no additional auth header needed**.


---
