Skip to main content
PUT
/
artifacts
/
{artifact_type}
/
{id}
Update Artifact
curl --request PUT \
  --url https://api.example.com/artifacts/{artifact_type}/{id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "metadata": {
    "metadata.name": "<string>",
    "metadata.id": "<string>",
    "metadata.type": "<string>"
  },
  "data": {
    "data.url": "<string>",
    "data.download_url": "<string>"
  }
}
'
{
  "metadata": {
    "metadata.name": "<string>",
    "metadata.id": "<string>",
    "metadata.type": "<string>"
  },
  "data": {
    "data.url": "<string>",
    "data.download_url": "<string>"
  }
}

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/GingerlyData247/SOTeam4-P2/llms.txt

Use this file to discover all available pages before exploring further.

Endpoint

PUT /artifacts/{artifact_type}/{id}

Parameters

artifact_type
string
required
Type of artifact to update:
  • model - Machine learning model
  • dataset - Training or evaluation dataset
  • code - Code repository or script
id
string
required
Unique identifier of the artifact to update. Must match the ID in the request body.

Authentication

Authentication headers may be required depending on deployment configuration.

Request Body

The request body must contain the complete artifact structure with updated values.
metadata
object
required
Artifact metadata
metadata.name
string
required
Name of the artifact
metadata.id
string
required
Unique identifier - must match the path parameter {id}
metadata.type
string
required
Artifact type: model, dataset, or code
data
object
required
Artifact data fields to update
data.url
string
required
New source URL for the artifact
data.download_url
string
Optional new pre-signed download URL

What Gets Updated

The update endpoint modifies:
  • source_uri - The source URL of the artifact (from data.url)
  • metadata.source_uri - Same URL stored in metadata
  • metadata.download_url - Pre-signed download URL (if provided)

What Does NOT Get Updated

The following fields are NOT updated by this endpoint:
  • Artifact name (immutable after creation)
  • Artifact ID (immutable)
  • Artifact type (immutable)
  • Computed metrics (reviewedness, net_score, etc.)
  • Lineage information
  • Tags or version
If you need to update metrics or lineage, you must delete and recreate the artifact.

Response

Returns the updated artifact with the same structure as the create/retrieve endpoints.
metadata
object
required
Artifact metadata
metadata.name
string
Name of the artifact (unchanged)
metadata.id
string
Unique identifier (unchanged)
metadata.type
string
Artifact type (unchanged)
data
object
required
Updated artifact data
data.url
string
Updated source URL
data.download_url
string
Updated download URL (if provided)

Error Codes

  • 400 - ID mismatch between path and request body
  • 404 - Artifact not found
  • 500 - Internal server error

ID Validation

The endpoint validates that the id in the URL path matches the metadata.id in the request body:
if body.metadata.id != id:
    raise HTTPException(
        status_code=400, 
        detail="Name/id mismatch in artifact update."
    )
Despite the error message saying “Name/id mismatch”, the validation only checks ID equality, not name.

Examples

curl -X PUT https://api.example.com/artifacts/model/12345 \
  -H "Content-Type: application/json" \
  -d '{
    "metadata": {
      "name": "BERT Base Uncased",
      "id": "12345",
      "type": "model"
    },
    "data": {
      "url": "https://huggingface.co/google-bert/bert-base-uncased-v2"
    }
  }'

Response Example

{
  "metadata": {
    "name": "BERT Base Uncased",
    "id": "12345",
    "type": "model"
  },
  "data": {
    "url": "https://huggingface.co/google-bert/bert-base-uncased-v2",
    "download_url": "https://s3.amazonaws.com/bucket/artifacts/model/12345.zip?signature=..."
  }
}

Use Cases

Update Model Version URL

When a new version of a model is released, update the source URL to point to the new version:
{
  "data": {
    "url": "https://huggingface.co/google-bert/bert-large-uncased"
  }
}

Refresh Download URL

Pre-signed URLs expire. Update the download URL with a fresh signature:
{
  "data": {
    "url": "https://huggingface.co/google-bert/bert-base-uncased",
    "download_url": "https://s3.amazonaws.com/bucket/model.zip?signature=NEW_SIG"
  }
}

Change Artifact Location

Move an artifact to a new storage location:
{
  "data": {
    "url": "https://new-storage.example.com/datasets/squad",
    "download_url": "https://new-storage.example.com/downloads/squad.zip"
  }
}

Implementation Notes

The update logic is implemented in /home/daytona/workspace/source/src/api/routers/models.py:1152:
@router.put("/artifacts/{artifact_type}/{id}", response_model=Artifact)
def artifact_update(artifact_type: str, id: str, body: Artifact):
    # Validate ID match
    if body.metadata.id != id:
        raise HTTPException(status_code=400, ...)
    
    # Fetch existing artifact
    item = _registry.get(id)
    if not item:
        raise HTTPException(status_code=404, ...)
    
    # Update URLs
    item["source_uri"] = body.data.url
    meta = item.setdefault("metadata", {})
    meta["source_uri"] = body.data.url
    
    if body.data.download_url is not None:
        meta["download_url"] = body.data.download_url
    
    return Artifact(...)

See Also

Build docs developers (and LLMs) love