docs/cli/commands/bootstrap.mdx
infisical bootstrap --domain=<domain> --email=<email> --password=<password> --organization=<organization>
The infisical bootstrap command is used when deploying Infisical in automated environments where manual UI setup is not feasible. It's ideal for:
The command initializes a fresh Infisical instance by creating an admin user, organization, and instance admin machine identity, enabling subsequent programmatic configuration without human intervention.
<Warning> This command creates an instance admin machine identity with the highest level of privileges. The returned token should be treated with the utmost security, similar to a root credential. Unauthorized access to this token could compromise your entire Infisical instance. </Warning># Example
infisical bootstrap --domain=https://your-infisical-instance.com
This flag is required.
</Accordion> <Accordion title="--email"> Email address for the admin user account that will be created. This can be set using the `INFISICAL_ADMIN_EMAIL` environment variable.# Example
infisical bootstrap [email protected]
This flag is required.
</Accordion> <Accordion title="--password"> Password for the admin user account. This can be set using the `INFISICAL_ADMIN_PASSWORD` environment variable.# Example
infisical bootstrap --password=your-secure-password
This flag is required.
</Accordion> <Accordion title="--organization"> Name of the organization that will be created within the instance. This can be set using the `INFISICAL_ADMIN_ORGANIZATION` environment variable.# Example
infisical bootstrap --organization=your-org-name
This flag is required.
</Accordion> <Accordion title="--ignore-if-bootstrapped"> Whether to continue without error if the instance has already been bootstrapped. Useful for idempotent automation scripts.# Example
infisical bootstrap --ignore-if-bootstrapped
This flag is optional and defaults to false.
# Kubernetes secret output
infisical bootstrap --output=k8-secret --k8-secret-template='{"data":{"token":"{{.Identity.Credentials.Token}}"}}' --k8-secret-name=infisical-bootstrap --k8-secret-namespace=default
When using k8-secret, the command will create or update a Kubernetes secret directly in your cluster. Note that this option requires the command to be executed from within a Kubernetes pod with appropriate service account permissions.
# Example template that stores the token
infisical bootstrap --k8-secret-template='{"data":{"token":"{{.Identity.Credentials.Token}}"}}'
# Example template with multiple fields
infisical bootstrap --k8-secret-template='{"stringData":{"token":"{{.Identity.Credentials.Token}}","org-id":"{{.Organization.ID}}","user-email":"{{.User.Email}}"}}'
Available template functions:
encodeBase64: Base64 encode a stringAvailable data fields:
.Identity.Credentials.Token: The machine identity token.Identity.ID: The identity ID.Identity.Name: The identity name.Organization.ID: The organization ID.Organization.Name: The organization name.Organization.Slug: The organization slug.User.Email: The admin user email.User.ID: The admin user ID.User.FirstName: The admin user first name.User.LastName: The admin user last nameThis flag is required when using k8-secret output.
# Example
infisical bootstrap --k8-secret-name=infisical-bootstrap-credentials
This flag is required when using k8-secret output.
# Example
infisical bootstrap --k8-secret-namespace=infisical-system
This flag is required when using k8-secret output.
The command returns a JSON response with details about the created user, organization, and machine identity:
{
"identity": {
"credentials": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGl0eUlkIjoiZGIyMjQ3OTItZWQxOC00Mjc3LTlkYWUtNTdlNzUyMzE1ODU0IiwiaWRlbnRpdHlBY2Nlc3NUb2tlbklkIjoiZmVkZmZmMGEtYmU3Yy00NjViLWEwZWEtZjM5OTNjMTg4OGRlIiwiYXV0aFRva2VuVHlwZSI6ImlkZW50aXR5QWNjZXNzVG9rZW4iLCJpYXQiOjE3NDIzMjI0ODl9.mqcZZqIFqER1e9ubrQXp8FbzGYi8nqqZwfMvz09g-8Y"
},
"id": "db224792-ed18-4277-9dae-57e752315854",
"name": "Instance Admin Identity"
},
"message": "Successfully bootstrapped instance",
"organization": {
"id": "b56bece0-42f5-4262-b25e-be7bf5f84957",
"name": "dog",
"slug": "dog-v-e5l"
},
"user": {
"email": "[email protected]",
"firstName": "Admin",
"id": "a418f355-c8da-453c-bbc8-6c07208eeb3c",
"lastName": "User",
"superAdmin": true,
"username": "[email protected]"
}
}
When using --output=k8-secret, the command creates or updates a Kubernetes secret in your cluster and logs the operation result. This is particularly useful for automated bootstrapping scenarios such as Kubernetes Jobs, GitOps workflows, or when you need to immediately store the admin credentials for use by other applications in your cluster.
When running with --output=k8-secret, the command must be executed from within a Kubernetes pod with proper service account permissions. The command automatically:
/var/run/secrets/kubernetes.io/serviceaccount/token/var/run/secrets/kubernetes.io/serviceaccount/ca.crtKUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT_HTTPS)Your service account needs the following permissions:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: infisical-bootstrap
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "create", "update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: infisical-bootstrap
subjects:
- kind: ServiceAccount
name: your-service-account
roleRef:
kind: Role
name: infisical-bootstrap
apiGroup: rbac.authorization.k8s.io
For automation purposes, you can extract just the machine identity token from the response:
infisical bootstrap --domain=https://your-infisical-instance.com [email protected] --password=your-secure-password --organization=your-org-name | jq ".identity.credentials.token"
This extracts only the token, which can be captured in a variable or piped to other commands.
TOKEN=$(infisical bootstrap --domain=https://your-infisical-instance.com [email protected] --password=your-secure-password --organization=your-org-name | jq -r ".identity.credentials.token")
# Now use the token for further automation
echo "Token has been captured and can be used for authentication"
k8-secret output, the command must run within a Kubernetes pod with proper service account permissions--ignore-if-bootstrapped flag is useful for making bootstrap scripts idempotent