Skip to main content
POST
/
v1
/
prepare_model_upload
cURL
curl --request POST \
--url https://api.baseten.co/v1/prepare_model_upload \
--header "Authorization: Bearer $BASETEN_API_KEY" \
--data '{
  "deployment": {
    "config": null,
    "raw_config": null,
    "user_env": null,
    "environment_name": null,
    "deploy_timeout_minutes": null,
    "deployment_name": null,
    "labels": null
  },
  "name": null,
  "team_id": null,
  "model_id": null
}'
{
  "creds": {
    "aws_access_key_id": "<string>",
    "aws_secret_access_key": "<string>",
    "aws_session_token": "<string>"
  },
  "s3_bucket": "<string>",
  "s3_key": "<string>",
  "s3_region": "<string>"
}

Authorizations

Authorization
string
header
required

Pass your Baseten API key. Clients automatically send Authorization: Bearer <key>. Direct callers can also use Authorization: Api-Key <key>; both schemes are accepted.

Body

application/json

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 · object
required

Deployment-level payload, identical to the payload sent at commit.

name
string | null

Set to validate a new-model push. Exactly one of name or model_id is required.

team_id
string | null

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 | null

Set to validate an add-deployment push to an existing model. Exactly one of name or model_id is required.

dry_run
boolean
default:false

If true, validate the payload only and do not issue upload credentials. The response sets creds, s3_bucket, and s3_key to null.

is_development
boolean
default:false

If true, validate a development-deployment push. Only valid when name is set. The following deployment fields must be left at their defaults: environment_name, preserve_env_instance_type, deployment_name.

Response

200 - application/json

Response from POST /v1/prepare_model_upload.

On success with dry_run=false, returns STS upload credentials. On success with dry_run=true, creds, s3_bucket, and s3_key are null and only validation has run.

creds
AWSCredentialsV1 · object

STS credentials to upload the model archive.

s3_bucket
string | null

S3 bucket the credentials are scoped to.

s3_key
string | null

S3 key the credentials are scoped to. Pass this to POST /v1/models (in the model_archive source) once the upload completes.

s3_region
string | null

AWS region the S3 bucket resides in.