Self HostingHeadless Initialization
Version: v3

Headless Initialization

By default, you need to create a user account, organization and project via the Langfuse UI before being able to use the API. You can find the API keys in the project settings within the UI.

If you want to automatically initialize these resources, you can optionally use the following LANGFUSE_INIT_* environment variables. When these variables are set, Langfuse will automatically create the specified resources on startup if they don’t already exist. This allows for easy integration with infrastructure-as-code and automated deployment pipelines.

Resource Dependencies

The different resources depend on each other.

You can e.g. intialize an organization and a user without having to also initialize a project and API keys, but you cannot initialize a project or user without also initializing an organization.

Organization
├── Project      (part of organization)
│   └── API Keys (set for project)
└── User         (owner of organization)

Environment Variables

Environment VariableDescriptionRequired to Create ResourceExample
LANGFUSE_INIT_ORG_IDUnique identifier for the organizationYesmy-org
LANGFUSE_INIT_ORG_NAMEName of the organizationNoMy Org
LANGFUSE_INIT_PROJECT_IDUnique identifier for the projectYesmy-project
LANGFUSE_INIT_PROJECT_NAMEName of the projectNoMy Project
LANGFUSE_INIT_PROJECT_PUBLIC_KEYPublic API key for the projectYeslf_pk_1234567890
LANGFUSE_INIT_PROJECT_SECRET_KEYSecret API key for the projectYeslf_sk_1234567890
LANGFUSE_INIT_USER_EMAILEmail address of the initial userYes[email protected]
LANGFUSE_INIT_USER_NAMEName of the initial userNoJohn Doe
LANGFUSE_INIT_USER_PASSWORDPassword for the initial userYespassword123

Troubleshooting

  • If you use LANGFUSE_INIT_* in Docker Compose, do not double-quote the values (GitHub issue).
  • The resources depend on one another (see note above). For example, you must create an organization to initialize a project.

Was this page useful?

Questions? We're here to help

Subscribe to updates