Skip to main content
Infrahub provides object storage for managing files and content. These endpoints allow you to upload and retrieve stored objects.

Get Object

Retrieve a stored object by its identifier.
GET /api/storage/object/{identifier}

Path Parameters

identifier
string
required
The unique identifier of the stored object

Response

Returns the stored content as a binary response.

Example

curl -X GET "https://infrahub.example.com/api/storage/object/abc123-def456" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -o downloaded-file.txt

Upload Content

Upload content as a string to object storage.
POST /api/storage/upload/content

Request Body

content
string
required
The content to upload as a string

Response

identifier
string
Unique identifier for the uploaded content
checksum
string
MD5 checksum of the uploaded content

Example

curl -X POST "https://infrahub.example.com/api/storage/upload/content" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "This is my file content"
  }'

Example Response

{
  "identifier": "019538e2-8b3a-7e3c-a5f4-8d2c1b3e4f5a",
  "checksum": "5d41402abc4b2a76b9719d911017c592"
}

Upload File

Upload a file using multipart form data.
POST /api/storage/upload/file

Request Body

file
file
required
The file to upload (multipart/form-data)

Response

identifier
string
Unique identifier for the uploaded file
checksum
string
MD5 checksum of the uploaded file

Example

curl -X POST "https://infrahub.example.com/api/storage/upload/file" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "file=@/path/to/local/file.txt"

Example Response

{
  "identifier": "019538e3-9c4b-8f4d-b6g5-9e3d2c4f5g6b",
  "checksum": "098f6bcd4621d373cade4e832627b4f6"
}

Upload Multiple Files

# Upload first file
RESPONSE1=$(curl -X POST "https://infrahub.example.com/api/storage/upload/file" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "[email protected]" -s)

ID1=$(echo $RESPONSE1 | jq -r '.identifier')

# Upload second file
RESPONSE2=$(curl -X POST "https://infrahub.example.com/api/storage/upload/file" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "[email protected]" -s)

ID2=$(echo $RESPONSE2 | jq -r '.identifier')

echo "Uploaded files: $ID1, $ID2"

Download and Verify Checksum

# Upload a file
RESPONSE=$(curl -X POST "https://infrahub.example.com/api/storage/upload/file" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "[email protected]" -s)

IDENTIFIER=$(echo $RESPONSE | jq -r '.identifier')
EXPECTED_CHECKSUM=$(echo $RESPONSE | jq -r '.checksum')

# Download the file
curl -X GET "https://infrahub.example.com/api/storage/object/$IDENTIFIER" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -o downloaded.txt

# Verify checksum
ACTUAL_CHECKSUM=$(md5sum downloaded.txt | awk '{print $1}')

if [ "$EXPECTED_CHECKSUM" = "$ACTUAL_CHECKSUM" ]; then
  echo "Checksum verified successfully"
else
  echo "Checksum mismatch!"
fi

Authentication

All storage endpoints require authentication using either:
  • Bearer Token: Include Authorization: Bearer YOUR_ACCESS_TOKEN header
  • API Key: Include X-API-KEY: YOUR_API_KEY header

Storage Backend

Infrahub uses a configurable storage backend. The default implementation stores files locally, but can be configured to use:
  • Local filesystem
  • Amazon S3
  • MinIO
  • Other S3-compatible storage
The storage identifier is a UUID that uniquely identifies the stored object across the system.

File Size Limits

Check your Infrahub configuration for file size limits. By default, uploads are subject to FastAPI’s default limits.

Use Cases

  • Configuration Files: Upload device configurations for versioning and comparison
  • Artifacts: Store generated artifacts from transformation pipelines
  • Backups: Archive backup files with checksums for integrity verification
  • Templates: Store Jinja2 templates or other template files

Build docs developers (and LLMs) love