---
url: /saas-starter/latest/guide/reference/configuration.md
---

# Configuration

::: tip What this page covers
Every choice of `--Persistence`, `--Auth`, `--IncludeTests` and `--Aspire`: a label says
which options a part is for. The copy in your app's `docs/` folder has only the parts for yours.
`ApiHost` stands for your app's name.
:::

Every setting ApiHost reads, by section. Set them in `appsettings.json`,
`appsettings.Production.json`, or environment variables, where `:` becomes `__`
(`Jwt:SigningKey` is `Jwt__SigningKey`); a list's items are numbered (`Accounts:AdminEmails:0`).
The defaults are the code's, or `appsettings.json`'s where it sets one. [Deployment](../deployment.md)
lists the ones to set in production.

::: info With accounts

## Accounts

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Accounts:AdminEmails:0` | `IList<string>` |  | Accounts with these emails are made admins once their email is confirmed (at startup, and when they log in). Set at least one in production, e.g. Accounts__AdminEmails__0. Removing an email here doesn't take the role away; do that on the admin page. ([AccountOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/AccountOptions.cs)) |
| `Accounts:AllowRegistration` | `bool` | `true` | When false, only people an admin invites can get an account (the admin page's Invite form). ([AccountOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/AccountOptions.cs)) |
| `Accounts:AskForProductNews` | `bool` | `true` | When true, sign-up has an unticked "Send me product news" box, and Settings → Preferences a switch for it; the choice is kept in UserPreferences.ProductNews. Turn it off if the app doesn't send product news. ([AccountOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/AccountOptions.cs)) |
| `Accounts:AuthAttemptsPerMinute` | `int` | `10` | Sign-in and account attempts (log in, register, password reset, two-factor codes and the like) allowed per client address per minute; more get 429 Too Many Requests. |
| `Accounts:PasswordBlockedWords:0` | `IList<string>` |  | Words new passwords mustn't be built from, besides the user's email and the app's name: your product, company and brand names, for example (Identity/CommonPasswords.cs). ([AccountOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/AccountOptions.cs)) |
| `Accounts:RejectBreachedPasswords` | `bool` | `false` | When true, new passwords that are known from data breaches are refused, checked with Have I Been Pwned without sending the password (Identity/BreachedPasswords.cs). Off by default, as it calls an outside service. ([AccountOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/AccountOptions.cs)) |
| `Accounts:RequireTwoFactorForAdmins` | `bool` | `false` | When true, the Admin role only works for accounts protected by two-factor authentication (or that sign in only with passkeys): other admins' tokens leave the role out, so the back office refuses them until they set it up in Settings (Identity/TwoFactor.cs). ([AccountOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/AccountOptions.cs)) |
| `Accounts:TwoFactorIssuer` | `string` | `ApiHost` | The name an authenticator app shows next to the account (two-factor authentication). ([AccountOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/AccountOptions.cs)) |
:::

## Analytics

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Analytics:ConnectOrigins:0` | `IList<string>` |  | Other origins Tag Manager's tags send data to or show tracking pixels from, such as https://*.google-analytics.com and https://*.google.com for Google Analytics. They're added to the page's Content-Security-Policy (Security/SecurityHeaders.cs) as connect-src and img-src, which otherwise block them. ([AnalyticsOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Analytics/AnalyticsOptions.cs)) |
| `Analytics:ConsentVersion` | `int` | `1` | Raise this when the cookie policy changes (a new tag that sets cookies, say): everyone is asked again, since what they agreed to was the old policy. ([AnalyticsOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Analytics/AnalyticsOptions.cs)) |
| `Analytics:GoogleTagManagerId` | `string` |  | The container's ID, such as GTM-ABC1234. ([AnalyticsOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Analytics/AnalyticsOptions.cs)) |
| `Analytics:ScriptOrigins:0` | `IList<string>` |  | Other origins tags load scripts from (Tag Manager's own is always allowed). Kept apart from ConnectOrigins because allowing scripts from a broad origin such as https://\*.google.com would let an attacker's injected script load through it. ([AnalyticsOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Analytics/AnalyticsOptions.cs)) |

::: info With organisations

## ApiKeys

| Setting | Type | Default | Notes |
|---|---|---|---|
| `ApiKeys:AllowedPaths:0` | `string[]` | `["/api/todos", "/mcp"]` | The API's paths an API key can be used on; everything else (account, organisation, billing and admin endpoints, and the realtime hub) needs a user's login. ([ApiKey.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Integrations/ApiKeys/ApiKey.cs)) |
| `ApiKeys:MaxPerOrganisation` | `int` | `25` |  ([ApiKey.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Integrations/ApiKeys/ApiKey.cs)) |
| `ApiKeys:RequestsPerMinute` | `int` | `120` | Requests a minute for each key, after which it gets 429 Too Many Requests. ([ApiKey.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Integrations/ApiKeys/ApiKey.cs)) |
| `ApiKeys:RotationGracePeriod` | `TimeSpan` | `1.00:00:00` | How long the old key keeps working after a rotation, so programs can switch over. ([ApiKey.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Integrations/ApiKeys/ApiKey.cs)) |
:::

## App

| Setting | Type | Default | Notes |
|---|---|---|---|
| `App:ClientUrl` | `string` |  | The app's public address, such as https://app.example.com. Links in emails, passkeys and the sitemap use it; required outside Development with accounts. |

## Attachments

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Attachments:MaxBytes` | `long` | `26214400 (25 MB)` | The largest file that may be attached. With Storage:Provider Local, Storage:Local: MaxUploadBytes must be at least this too. ([TodoAttachments.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Features/Todos/TodoAttachments.cs)) |
| `Attachments:MaxPerTodo` | `int` | `10` | How many files one Todo may have. ([TodoAttachments.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Features/Todos/TodoAttachments.cs)) |

::: info With accounts

## Authentication

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Authentication:GitHub:ClientId` | `string` |  | With ClientSecret: turns on "Continue with GitHub". |
| `Authentication:GitHub:ClientSecret` | `string` |  |  |
| `Authentication:Google:ClientId` | `string` |  | With ClientSecret: turns on "Continue with Google" ([how-to](../how-to/set-up-external-sign-in.md)). |
| `Authentication:Google:ClientSecret` | `string` |  |  |
:::

::: info With organisations

## Billing

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Billing:Currency` | `string` | `USD` | The currency of prices shown and charged, when the organisation hasn't chosen one. ([BillingAccount.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Billing/BillingAccount.cs)) |
| `Billing:Stripe:AutomaticTax` | `bool` | `false` | Stripe Tax: Stripe works out and adds sales tax and VAT. Turn it on in the Stripe dashboard first. (Stripe charges for it.) ([StripePaymentProvider.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Billing/Stripe/StripePaymentProvider.cs)) |
| `Billing:Stripe:SecretKey` | `string` |  | From the Stripe dashboard (Developers > API keys): sk_test\_... while testing, sk_live\_... in production. ([StripePaymentProvider.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Billing/Stripe/StripePaymentProvider.cs)) |
| `Billing:Stripe:WebhookSecret` | `string` |  | The webhook endpoint's signing secret (whsec\_...), from the dashboard or `stripe listen`. ([StripePaymentProvider.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Billing/Stripe/StripePaymentProvider.cs)) |
| `Billing:TrialDays` | `int` | `14` | The reverse trial: a new organisation gets TrialPlan for this many days, then the free plan unless it subscribes. 0 turns trials off. ([BillingAccount.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Billing/BillingAccount.cs)) |
| `Billing:TrialPlan` | `string` | `PlanCatalogue.Pro` |  ([BillingAccount.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Billing/BillingAccount.cs)) |
:::

## ConnectionStrings

| Setting | Type | Default | Notes |
|---|---|---|---|
|  `ConnectionStrings:Marten` | `string` | `Host=localhost;Port=5432;Database=apihost;Username=postgres;Password=postgres` | The PostgreSQL database, for Marten and Wolverine. |
|  `ConnectionStrings:Postgres` | `string` | `Host=localhost;Port=5432;Database=apihost;Username=postgres;Password=postgres` | The PostgreSQL database, for EF Core and Wolverine. |

::: info With accounts

## Email

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Email:Smtp:From` | `string` |  | The sender, as an address or "Name \<address>". ([SmtpEmailSender.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/Email/SmtpEmailSender.cs)) |
| `Email:Smtp:Host` | `string` |  |  ([SmtpEmailSender.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/Email/SmtpEmailSender.cs)) |
| `Email:Smtp:Password` | `string` |  |  ([SmtpEmailSender.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/Email/SmtpEmailSender.cs)) |
| `Email:Smtp:Port` | `int` | `587` |  ([SmtpEmailSender.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/Email/SmtpEmailSender.cs)) |
| `Email:Smtp:Security` | `SecureSocketOptions` | `SecureSocketOptions.Auto` | Auto (the default) uses TLS when the server offers it; None for a local test server such as Mailpit; SslOnConnect for port 465; StartTls to require TLS on port 587. ([SmtpEmailSender.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/Email/SmtpEmailSender.cs)) |
| `Email:Smtp:UserName` | `string` |  |  ([SmtpEmailSender.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/Email/SmtpEmailSender.cs)) |
:::

::: info With accounts

## Jwt

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Jwt:AccessTokenLifetimeMinutes` | `int` | `15` | How long an access token works. Nothing can revoke one before it expires, so keep it short. ([JwtOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/JwtOptions.cs)) |
| `Jwt:Audience` | `string` | `ApiHost` |  ([JwtOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/JwtOptions.cs)) |
| `Jwt:Issuer` | `string` | `ApiHost` |  ([JwtOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/JwtOptions.cs)) |
| `Jwt:RefreshTokenLifetimeDays` | `int` | `14` | How long a session lasts unused: each refresh token expires this long after it was issued, and every refresh issues a new one. ([JwtOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/JwtOptions.cs)) |
| `Jwt:RefreshTokenReuseGraceSeconds` | `int` | `30` | How long a rotated refresh token is still accepted (see RefreshEndpoint): two tabs refreshing at the same moment, or an app that lost the response to its refresh, aren't taken for a stolen token. 0 turns it off. ([JwtOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/JwtOptions.cs)) |
| `Jwt:SessionLifetimeDays` | `int` | `30` | How long a session lasts at most, however often it's used: then the user signs in again (NIST SP 800-63B's 30 days for AAL1). 0 lets sessions last as long as they're used. ([JwtOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/JwtOptions.cs)) |
| `Jwt:SigningKey` | `string` |  |  ([JwtOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Identity/JwtOptions.cs)) |
:::

## Legal

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Legal:PrivacyUrl` | `string` |  |  ([LegalOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Legal/LegalOptions.cs)) |
| `Legal:TermsUrl` | `string` |  | Where the documents are: a page of this app ("/terms") or a full address ("https://example.com/terms"). ([LegalOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Legal/LegalOptions.cs)) |
| `Legal:Version` | `int` | `1` | Raise this when either document changes in a way people should agree to again: everyone is asked to accept the new version when they next use the app. ([LegalOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Legal/LegalOptions.cs)) |

::: info With accounts

## Notifications

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Notifications:KeepPerUser` | `int` | `100` | How many a user keeps: older ones are deleted as new ones arrive. ([Notification.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Notifications/Notification.cs)) |
:::

::: info With organisations

## Organisations

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Organisations:InvitationsPerHour` | `int` | `20` | Invitations each user can send an hour, across their organisations; after that they get 429 Too Many Requests. ([OrganisationOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Organisations/OrganisationOptions.cs)) |
| `Organisations:MaxPendingInvitations` | `int` | `100` | Unexpired invitations an organisation can have waiting at once. ([OrganisationOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Organisations/OrganisationOptions.cs)) |
:::

## Other

| Setting | Type | Default | Notes |
|---|---|---|---|
| `OTEL_EXPORTER_OTLP_ENDPOINT` | `string` |  | Where to send traces, metrics and logs (OpenTelemetry over OTLP); unset, they are not exported. |

::: info With accounts

## Pictures

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Pictures:Gravatar` | `bool` | `false` | Show a user's Gravatar (https://gravatar.com) when they haven't uploaded a picture. Off by default: the browser would ask Gravatar for it with a SHA-256 hash of the user's email, which tells a third party the hash and the viewer's IP address, so turn it on only if your privacy policy says so. Without it, the user's initials are shown. ([PictureFiles.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Pictures/PictureFiles.cs)) |
| `Pictures:UploadsPerMinute` | `int` | `10` | Picture, logo and Todo attachment uploads allowed per user per minute; more get 429 Too Many Requests. ([PictureFiles.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Pictures/PictureFiles.cs)) |
:::

## Storage

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Storage:AzureBlob:ConnectionString` | `string` |  | A connection string with the account key (signed URLs are signed with it). ([StorageOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Storage/StorageOptions.cs)) |
| `Storage:AzureBlob:Container` | `string` | `files` |  ([StorageOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Storage/StorageOptions.cs)) |
| `Storage:Local:MaxUploadBytes` | `long` | `26214400 (25 MB)` | The largest upload the app accepts through a signed URL. (With S3 and Azure the store takes any size, so features check sizes after the upload; see IFileStorage.) ([StorageOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Storage/StorageOptions.cs)) |
| `Storage:Local:RootPath` | `string` | `data/files` | The folder files are kept in, relative to the app's folder unless absolute. In a container, mount a volume here (deploy/docker-compose.yml does), or files are lost with the container. ([StorageOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Storage/StorageOptions.cs)) |
| `Storage:Provider` | `Local, S3, AzureBlob` | `Local` |  ([StorageOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Storage/StorageOptions.cs)) |
| `Storage:S3:AccessKey` | `string` |  | Leave both empty on AWS to use the SDK's usual sources (environment variables, an instance or task role). ([StorageOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Storage/StorageOptions.cs)) |
| `Storage:S3:Bucket` | `string` |  |  ([StorageOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Storage/StorageOptions.cs)) |
| `Storage:S3:ForcePathStyle` | `bool` | `false` | Puts the bucket in the URL's path (https://host/bucket/key) rather than its host name (https://bucket.host/key). Self-hosted stores usually need this. ([StorageOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Storage/StorageOptions.cs)) |
| `Storage:S3:Region` | `string` | `us-east-1` | AWS: the bucket's region, such as eu-west-1. Other stores: whatever region they document ("auto" for Cloudflare R2, "us-east-1" for most self-hosted stores). ([StorageOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Storage/StorageOptions.cs)) |
| `Storage:S3:SecretKey` | `string` |  |  ([StorageOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Storage/StorageOptions.cs)) |
| `Storage:S3:ServiceUrl` | `string` |  | The store's endpoint, such as https://\<account>.r2.cloudflarestorage.com or https://s3.eu-central-003.backblazeb2.com. Leave empty for AWS S3 itself, which uses Region. ([StorageOptions.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Storage/StorageOptions.cs)) |

::: info With organisations

## Webhooks

| Setting | Type | Default | Notes |
|---|---|---|---|
| `Webhooks:AllowPrivateNetworks` | `bool` | `false` | Lets webhooks go to localhost and private networks, and over plain HTTP. On in Development only: in production a webhook URL could otherwise be used to reach the app's own network. ([Webhook.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Integrations/Webhooks/Webhook.cs)) |
| `Webhooks:Incoming:Secrets:<name>` | `IDictionary<string, string>` | `new Dictionary<string, string>(StringComparer.Ordinal)` | Signing secret ("whsec\_...") by source name, such as "chat". ([IncomingWebhooks.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Integrations/Webhooks/IncomingWebhooks.cs)) |
| `Webhooks:KeepDeliveriesFor` | `TimeSpan` | `30.00:00:00` | Deliveries older than this are deleted when new ones are made. ([Webhook.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Integrations/Webhooks/Webhook.cs)) |
| `Webhooks:MaxPerOrganisation` | `int` | `10` |  ([Webhook.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Integrations/Webhooks/Webhook.cs)) |
| `Webhooks:Timeout` | `TimeSpan` | `00:00:10` | How long a receiver has to answer. ([Webhook.cs](https://github.com/LibreSharp/saas-starter/blob/v0.10.1/src/ApiHost/Integrations/Webhooks/Webhook.cs)) |
:::
