---
title: "Generate Upload URL"
method: POST
path: "/organizations/{orgId}/fileuploads/measurements/generateUploadUrl"
tags: ["Measurements"]
---

# Generate Upload URL

`POST /organizations/{orgId}/fileuploads/measurements/generateUploadUrl`

## Request

- Base URL: `https://api.m3ter.com`
- URL: `https://api.m3ter.com/organizations/{orgId}/fileuploads/measurements/generateUploadUrl`
- Auth: OAuth 2
  - Authorization code: `https://m3ter.auth.us-east-1.amazoncognito.com/oauth2/authorize`, token URL `https://m3ter.auth.us-east-1.amazoncognito.com/oauth2/token`
  - Client credentials, token URL `/oauth/token`
  - Scopes: `measurements:fileUpload`
- TypeScript: <https://skmtc.dev/m3ter-com/apis/m3ter-api/docs/organizations/:orgId/fileuploads/measurements/generateUploadUrl/post.ts> (a function with typed inputs; its response is checked against the schema)

Generate a URL for uploading a file containing measurements to the platform in preparation for the measurements it contains to be ingested:
- An upload URL is returned together with an upload job id:
- You can then upload your data measurements file using a `PUT` request using the returned upload URL as the endpoint.
- You can use the returned upload job id with other calls to the File Upload Service for any follow-up or troubleshooting.

**Important:**
* The `contentLength` request parameter is required.
* The upload URL is time limited - it is valid for ***one*** minute.

Part of the file upload service for submitting measurements data files.

## Path parameters

- `orgId` string, required

## Request body

- GetUploadUrlRequest: Request containing the file details when generating an upload URL.
  - `fileName` string, required: The name of the measurements file to be uploaded.
  - `contentType` 'application/json' | 'text/json', required: The media type of the entity body sent, for example: `"contentType":"text/json"`. **NOTE:** Currently only a JSON formatted file type is supported by the File Upload Service.
  - `contentLength` integer, required: The size of the body in bytes. For example: `"contentLength": 485`, where 485 is the size in bytes of the file to upload. **NOTE:** Required.

## Response `200`

Returns the upload URL and jobId

- UrlUploadResponse: Response containing the upload job URL details
  - `jobId` string: UUID of the upload job
  - `url` string: The URL
  - `headers` object: The headers

## Other responses

- `4XX`: Error message
- `5XX`: Error message

## Changes

- **2026-10-16** `85c514abc692`: 1 breaking, 1 info
  - the `headers` response's property type changed from no type to `object` for status `200`
  - removed `subschema #1, subschema #2` from the `headers` response property `allOf` list for the response status `200`
- **2025-08-01** `9f9e5f3dbde7`: 2 breaking, 2 info
  - request property `contentType` was restricted to a list of enum values
  - the request property `contentLength` became required
  - added the new `application/json` enum value to the request property `contentType`
  - added the new `text/json` enum value to the request property `contentType`
- **2025-02-04** `9433593378b5`: 1 breaking, 1 info
  - the `headers` response's property type changed from `object` to no type for status `200`
  - added `subschema #1, subschema #2` to the `headers` response property `allOf` list for the response status `200`

[Operation history](https://skmtc.dev/m3ter-com/apis/m3ter-api/changes/organizations/:orgId/fileuploads/measurements/generateUploadUrl/post.md)

---

[API](https://skmtc.dev/m3ter-com/apis/m3ter-api.md) - [All operations](https://skmtc.dev/m3ter-com/apis/m3ter-api/llms.txt) - [OpenAPI document](https://skmtc.dev/m3ter-com/apis/m3ter-api/revisions/85c514abc692?raw)
