MinIO — API Surface#
API types#
REST/HTTP (S3-compatible) · Admin REST (madmin) · STS REST (AWS-compatible) · Prometheus Metrics HTTP · Internal Grid RPC (WebSocket/binary) · CLI · FTP/SFTP (protocol gateways)
REST/HTTP API — S3-Compatible (registerAPIRouter)#
Router#
github.com/minio/mux — a maintained fork of gorilla/mux. Routes registered imperatively in cmd/api-router.go:255 via registerAPIRouter(*mux.Router). Supports virtual-hosted-style bucket routing ({bucket}.domain) and path-style (/{bucket}). Both are registered simultaneously.
Route registration#
All routes are registered programmatically in registerAPIRouter. Each handler is wrapped in s3APIMiddleware(handlerFunc, flags...) which applies tracing, gzip, throttling, and stats collection per-endpoint using bit-flags (noGZS3HFlag, traceHdrsS3HFlag, noThrottleS3HFlag).
Middleware chain (global — globalMiddlewares in cmd/routers.go:54)#
Applied to every request before any route-specific handler:
| Order | Middleware | Purpose |
|---|---|---|
| 1 | addCustomHeadersMiddleware | Injects x-amz-request-id and other standard headers |
| 2 | httpTracerMiddleware | Distributed HTTP tracing (captures all early-return paths) |
| 3 | setAuthMiddleware | Validates AWS SigV4 / presigned / STS bearer tokens; validates Date header |
| 4 | setBrowserRedirectMiddleware | Redirects web console prefixes to static location |
| 5 | setCrossDomainPolicyMiddleware | Serves legacy crossdomain.xml for Flash clients |
| 6 | setRequestLimitMiddleware | Enforces max body/header sizes |
| 7 | setRequestValidityMiddleware | Validates request format and S3 protocol constraints |
| 8 | setUploadForwardingMiddleware | Forwards uploads to primary site during site replication |
| 9 | setBucketForwardingMiddleware | Bucket-level proxy forwarding for distributed scenarios |
Per-handler S3 middleware (s3APIMiddleware) additionally applies: tracing (headers only or full body), gzip response compression, and maxClients throttling.
Authentication#
- AWS Signature Version 4 (SigV4) — primary auth for all S3 and admin requests
- Presigned URLs — V2 and V4 signed URLs for time-limited object access
- STS bearer tokens — short-lived credentials from the STS API
- Anonymous access — for public bucket policies
Key S3 API endpoints (/{bucket}/{object} and /{bucket})#
Object operations:
| Method | Path / Query | Handler | Notes |
|---|---|---|---|
HEAD | /{object} | HeadObjectHandler | Object existence + metadata |
GET | /{object}?attributes | GetObjectAttributesHandler | Object attributes only |
GET | /{object} | GetObjectHandler | Download object |
GET | /{object}?lambdaArn=... | GetObjectLambdaHandler | Object transform via lambda |
PUT | /{object} | PutObjectHandler | Upload object |
PUT | /{object} (snowball header) | PutObjectExtractHandler | Auto-extract ZIP on upload (MinIO extension) |
PUT | /{object} (copy-source header) | CopyObjectHandler | Server-side copy |
DELETE | /{object} | DeleteObjectHandler | Delete object (versioned or not) |
POST | /{object}?uploads | NewMultipartUploadHandler | Initiate multipart |
PUT | /{object}?partNumber&uploadId | PutObjectPartHandler | Upload part |
PUT | /{object}?partNumber&uploadId (copy-source) | CopyObjectPartHandler | Copy part |
GET | /{object}?uploadId | ListObjectPartsHandler | List parts |
POST | /{object}?uploadId | CompleteMultipartUploadHandler | Complete multipart |
DELETE | /{object}?uploadId | AbortMultipartUploadHandler | Abort multipart |
GET/PUT | /{object}?acl | GetObjectACLHandler / PutObjectACLHandler | Stub (ACLs not enforced) |
GET/PUT/DELETE | /{object}?tagging | Tag CRUD handlers | Object tagging |
GET/PUT | /{object}?retention | Retention handlers | Object lock / WORM |
GET/PUT | /{object}?legal-hold | Legal hold handlers | Legal hold |
POST | /{object}?select&select-type=2 | SelectObjectContentHandler | S3 Select (SQL over objects) |
POST | /{object}?restore | PostRestoreObjectHandler | Restore from cold tier |
Bucket operations:
| Method | Query | Handler |
|---|---|---|
PUT | (none) | PutBucketHandler — create bucket |
HEAD | (none) | HeadBucketHandler — existence check |
DELETE | (none) | DeleteBucketHandler |
GET | ?location | GetBucketLocationHandler |
GET/PUT/DELETE | ?policy | Bucket IAM policy CRUD |
GET/PUT/DELETE | ?lifecycle | ILM lifecycle rules |
GET/PUT/DELETE | ?encryption | SSE-S3/SSE-KMS configuration |
GET/PUT | ?object-lock | Object lock configuration |
GET/PUT/DELETE | ?replication | Bucket replication config |
GET/PUT | ?versioning | Versioning config |
GET/PUT | ?notification | Event notification config |
GET | ?events=... | ListenNotificationHandler — SSE stream |
GET/PUT/DELETE | ?tagging | Bucket tags |
GET | ?uploads | ListMultipartUploadsHandler |
GET | ?list-type=2 | ListObjectsV2Handler |
GET | ?list-type=2&metadata=true | ListObjectsV2MHandler (MinIO extension — includes metadata) |
GET | ?versions | ListObjectVersionsHandler |
GET | ?versions&metadata=true | ListObjectVersionsMHandler (MinIO extension) |
GET | ?policyStatus | GetBucketPolicyStatusHandler |
POST | (delete) | DeleteMultipleObjectsHandler |
POST | (post policy) | PostPolicyBucketHandler |
GET/PUT | ?replication-metrics[=2] | Replication metrics (MinIO extension) |
GET | ?replication-reset-status | ResetBucketReplicationStatusHandler (MinIO extension) |
PUT | ?replication-reset | ResetBucketReplicationStartHandler (MinIO extension) |
GET | ?replication-check | ValidateBucketReplicationCredsHandler (MinIO extension) |
Root operations:
| Method | Path | Handler |
|---|---|---|
GET | / | ListBucketsHandler |
GET | /?events=... | ListenNotificationHandler (cluster-wide SSE) |
Admin API (/minio/admin/v3/...)#
Registered in cmd/admin-router.go:138 via registerAdminRouter(*mux.Router, enableConfigOps bool). Uses adminMiddleware which adds logger.ReqInfo context, emits audit log on completion, and checks object layer availability.
Service management:
POST /service?action=...&type=2— restart/stop server (v2)POST /update?updateURL=...&type=2— rolling update (v2)
Observability:
GET /info— cluster/node infoGET /storageinfo— storage capacity and drive healthGET /datausageinfo— per-bucket data usageGET /metrics— cluster metrics snapshotGET /trace— live HTTP trace stream (SSE)GET /log— live console log streamGET /healthinfo//obdinfo— health diagnostic bundleGET/POST /inspect-data— raw metadata inspection toolPOST /speedtest/object|drive|net|site— benchmarking endpointsPOST /profile?profilerType=...— pprof profiling
Healing (erasure mode only):
POST /heal/[{bucket}[/{prefix}]]— trigger heal scanPOST /background-heal/status— background healer status
Pool management (distributed erasure only):
GET /pools/list— list all server poolsGET /pools/status?pool=...— pool decommission statusPOST /pools/decommission?pool=...— start decommissionPOST /pools/cancel?pool=...— cancel decommissionPOST /rebalance/start|GET /rebalance/status|POST /rebalance/stop— data rebalancing
IAM (users, groups, policies):
PUT /add-user?accessKey=...— create userDELETE /remove-user?accessKey=...GET /list-users[?bucket=...]GET /user-info?accessKey=...PUT /set-user-status?accessKey=...&status=...PUT /add-canned-policy?name=...— create policyDELETE /remove-canned-policy?name=...GET /info-canned-policy?name=...GET /list-canned-policies[?bucket=...]PUT /set-user-or-group-policy?policyName=...&userOrGroup=...&isGroup=...POST /idp/builtin/policy/{attach|detach}— attach/detach policiesPUT/DELETE/GET /update-group-members|/group|/groups|/set-group-statusPUT /add-service-account— create service account (AKID/secret pair)POST /update-service-account?accessKey=...GET /info-service-account?accessKey=...GET /list-service-accountsDELETE /delete-service-account?accessKey=...GET /temporary-account-info?accessKey=...— STS account infoGET /list-access-keys-bulk?listType=...— bulk key listingGET /export-iam/PUT /import-iam[-v2]— IAM backup/restoreGET /accountinfo— current user account info
Identity providers (LDAP, OpenID):
PUT/POST/GET/DELETE /idp-config/{type}/{name}— IDP configuration CRUDPUT /idp/ldap/add-service-account— LDAP-linked service accountGET /idp/ldap/list-access-keys[?userDN=...]POST /idp/ldap/policy/{attach|detach}GET /idp/builtin/policy-entities|/idp/ldap/policy-entitiesGET /idp/openid/list-access-keys-bulk
Bucket administration:
GET /get-bucket-quota?bucket=...|PUT /set-bucket-quota?bucket=...GET /list-remote-targets?bucket=...&type=...PUT /set-remote-target?bucket=...— configure replication remoteDELETE /remove-remote-target?bucket=...&arn=...POST /replication/diff?bucket=...— pending replication diffGET /replication/mrf?bucket=...— most-recently-failed replication entriesGET /export-bucket-metadata|PUT /import-bucket-metadata— migration
Batch jobs:
POST /start-job|GET /list-jobs|GET /status-job|GET /describe-job|DELETE /cancel-job
Tiered storage (ILM):
PUT /tier|POST /tier/{tier}|GET /tier|DELETE /tier/{tier}|GET /tier/{tier}(verify)GET /tier-stats
Site replication (cluster-level):
PUT /site-replication/add|remove|editGET /site-replication/info|metainfo|status- Internal peer-to-peer sync endpoints:
/site-replication/peer/* PUT /site-replication/resync/op?operation=...
Distributed locking (dist erasure only):
GET /top/locks— active distributed locksPOST /force-unlock?paths=...
KMS:
POST /kms/statusPOST /kms/key/create?key-id=...GET /kms/key/status
Config KV:
GET /get-config-kv?key=...|PUT /set-config-kv|DELETE /del-config-kvGET /list-config-history-kv|DELETE /clear-config-history-kv|PUT /restore-config-history-kvGET /config|PUT /config— bulk import/export
STS API — AWS-Compatible (registerSTSRouter)#
All endpoints receive POST / with application/x-www-form-urlencoded body. Distinguishes actions via query parameters.
| Handler | Action query | Auth mechanism |
|---|---|---|
AssumeRole | (implicit — SigV4 header only) | SigV4 with root/IAM credentials |
AssumeRoleWithSSO | (implicit — JWT only) | JWT bearer (OIDC/WebIdentity) |
AssumeRoleWithClientGrants | Action=AssumeRoleWithClientGrants | JWT token |
AssumeRoleWithWebIdentity | Action=AssumeRoleWithWebIdentity | JWT web identity token |
AssumeRoleWithLDAPIdentity | Action=AssumeRoleWithLDAPIdentity | LDAP username/password |
AssumeRoleWithCertificate | Action=AssumeRoleWithCertificate | mTLS client certificate |
AssumeRoleWithCustomToken | Action=AssumeRoleWithCustomToken | Custom plugin token |
All return temporary credentials (access key, secret, session token) with configurable duration.
Metrics API — Prometheus-Compatible (registerMetricsRouter)#
Mounted under /minio/.... Auth controlled by MINIO_PROMETHEUS_AUTH_TYPE (jwt [default] or public).
| Path | Description |
|---|---|
/minio/prometheus/metrics | Legacy all-in-one Prometheus scrape endpoint |
/minio/v2/metrics/cluster | V2 cluster-wide metrics |
/minio/v2/metrics/bucket | V2 per-bucket metrics |
/minio/v2/metrics/node | V2 per-node metrics |
/minio/v2/metrics/resource | V2 resource metrics |
/minio/metrics/v3/{pathComps} | V3 hierarchical metrics (supports ?list to enumerate sub-paths) |
KMS API (/minio/kms/v1/...)#
Registered separately via cmd/kms-router.go. Endpoints for KMS key management and status.
GET /metrics— KMS metricsPOST /status,POST /key/create,GET /key/status
Internal Grid RPC (internal/grid)#
Not a user-facing API, but defines the intra-cluster communication surface:
grid.RoutePath(/minio/grid/ws/) — general-purpose cluster RPC (typed handler registration)grid.RouteLockPath(/minio/grid/lock/) — distributed locking RPC
Handlers registered on startup in registerDistErasureRouters and registerLockRESTHandlers. Message types are code-generated; handlers registered with grid.Manager.Register(id, handler).
Also includes legacy REST-based peer protocols (/minio/storage/{version}/..., /minio/peer/{version}/...) for operations not yet migrated to the grid.
CLI#
- Framework:
github.com/urfave/cli(v1-style) - Entry point:
cmd/main.go→newApp("minio") - Commands:
| Command | Purpose |
|---|---|
| `minio server [flags] {path | url}…` |
minio fmt-gen | Internal code generation utility (build-time only) |
The server command is the only meaningful command for end-users. Flags include:
--address— listen address (default:9000)--console-address— embedded console listen address--certs-dir/--certs-file— TLS--config— YAML config file path--ftp/--sftp— enable FTP/SFTP protocol gateways--quiet,--anonymous,--json— output formatting
FTP / SFTP (Protocol Gateways)#
Started as background goroutines during serverMain() when --ftp or --sftp flags are present. Not HTTP — these are independent protocol servers that translate FTP/SFTP operations to ObjectLayer calls, providing an S3-equivalent surface over legacy protocols.
Plugin / Extension system#
MinIO has no external plugin mechanism. Extension happens via:
- Lambda functions / Object Lambda:
GetObjectLambdaHandlerroutes GET requests through a configured ARN before returning data. The function URL is registered per-bucket via bucket configuration. - Event notification targets: Kafka, NATS, Redis, Elasticsearch, AMQP, MySQL, PostgreSQL, NSQ, Webhook — configured as notification targets in the object store config. Not a plugin interface in the code; each target type is compiled in.
- Batch jobs: Users define YAML job specs (replicate, key-rotate, expire, archive) submitted via
POST /admin/v3/start-job. Built-in job executor, not extensible by third-party code. - Identity providers: LDAP and OpenID Connect are the two external integration points for IAM. New IDP types cannot be added without modifying the core.
Library API#
MinIO is primarily a server binary, not a library. However:
github.com/minio/madmin-go— the separatemadminmodule provides the Go client library for the Admin API. It is versioned independently and widely used by tools (mc, operators).github.com/minio/minio-go— separate S3 client library (not in this repo).internal/packages are not exported —internal/grid,internal/dsync,internal/hash,internal/cryptoetc. are all private.cmd/package is a single flat package with no public library intent. All exported symbols incmd/are incidental to Go’s visibility rules, not an intentional public API.