---
title: "Validates a model push payload and issues upload credentials"
method: POST
path: "/v1/prepare_model_upload"
---

# Validates a model push payload and issues upload credentials

`POST /v1/prepare_model_upload`

## Request body

- PrepareModelUploadRequestV1 — Body for `POST /v1/prepare_model_upload`. Validates the same payload the commit endpoint will validate, and on `dry_run=false` issues STS upload credentials. Exactly one of `name` or `model_id` is required: `name` validates the new-model path (`POST /v1/models`); `model_id` validates the add-deployment path (`POST /v1/models/{model_id}/deployments`).
  - `deployment` DeploymentArchivePayloadV1, required — Deployment-level fields for a model-archive push. Shared by every endpoint that creates a deployment from an uploaded archive: `POST /v1/prepare_model_upload`, the `model_archive` source on `POST /v1/models`, and `POST /v1/models/{model_id}/deployments`.
    - `config` object, required — Parsed model config as a JSON object.
    - `raw_config` string, nullable — Original config.yaml text, persisted as-is on the deployment. Best-effort: invalid raw configs are logged and dropped without failing the request.
    - `user_env` object, nullable — Client environment metadata (e.g. client version, Python version). Validated server-side.
    - `environment_name` string, nullable — Stable environment to push to (e.g. `production`). If unset, the deployment is created without environment selection. Caller must have push permission for the named environment.
    - `preserve_env_instance_type` boolean — Retain the target environment's current instance type rather than the one in `config`. Only meaningful when `environment_name` is set and that environment already exists.
    - `deploy_timeout_minutes` integer, nullable — Deploy timeout in minutes; allowed range 10 to 1440. Server default applies if unset.
    - `deployment_name` string, nullable — Optional human-readable name for the deployment.
    - `labels` object, nullable — User-provided key-value labels for the deployment.
    - `is_development` boolean — If true, push as a development deployment: the model's single mutable dev slot, created if absent and overwritten in place otherwise. The following fields must be left at their defaults: `environment_name`, `preserve_env_instance_type`, `deployment_name`.
  - `name` string, nullable — Set to validate a new-model push. Exactly one of `name` or `model_id` is required.
  - `team_id` string, nullable — Team the new model will belong to. Only valid when `name` is set; defaults to the organization's default team when omitted. Must not be set when `model_id` is set (the existing model already has a team).
  - `model_id` string, nullable — Set to validate an add-deployment push to an existing model. Exactly one of `name` or `model_id` is required.
  - `dry_run` boolean — If true, validate the payload only and do not issue upload credentials. The response sets `creds`, `s3_bucket`, and `s3_key` to `null`.

## Response `200`

- PrepareModelUploadResponseV1 — Response from `POST /v1/prepare_model_upload`. Returns STS upload credentials when the push requires an archive upload. All four fields (`creds`, `s3_bucket`, `s3_key`, `s3_region`) are `null` when no upload is needed: either `dry_run=true` (validation only) or a model format that is not built from an uploaded archive (for example, BIS-LLM, which is built from its config alone).
  - `creds` AWSCredentialsV1 — AWS credentials
    - `aws_access_key_id` string, required — The AWS access key ID
    - `aws_secret_access_key` string, required — The AWS secret access key
    - `aws_session_token` string, required — The AWS session token
  - `s3_bucket` string, nullable — S3 bucket the credentials are scoped to. Null when no archive upload is required.
  - `s3_key` string, nullable — S3 key the credentials are scoped to. Pass this to `POST /v1/models` (in the `model_archive` source) once the upload completes. Null when no archive upload is required.
  - `s3_region` string, nullable — AWS region the S3 bucket resides in. Null when no archive upload is required.

---

[API](https://skmtc.net/baseten/apis/baseten-inference-api.md) · [All operations](https://skmtc.net/baseten/apis/baseten-inference-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/baseten/baseten-inference-api/versions/a55a2f64c3c5/schema)
