> ## Documentation Index
> Fetch the complete documentation index at: https://docs.foveus.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Install dotnet sdk

Install the Foveus .NET SDK to capture executions from your API or worker service.

The SDK connects your service to Foveus and sends execution telemetry to your workspace.

## Install the package

Add the SDK package to your service.

```bash theme={null}
dotnet add package Foveus.SDK
```

<Note>
  During private beta, your package name or package source may be different. Use the package name and feed URL provided during onboarding.
</Note>

## Configure the SDK

You can configure Foveus in three ways.

### Minimal setup

Use this for local testing or quick validation.

```csharp theme={null}
builder.Services.AddFoveus("fov_test_...");
```

<Warning>
  Do not hardcode API keys in production code. Use this only for quick local testing.
</Warning>

### Configuration-based setup

For most applications, configure Foveus from `appsettings.json`, environment variables, or your secret manager.

```csharp theme={null}
builder.Services.AddFoveus(builder.Configuration);
```

Add a `Foveus` section to your configuration.

```json theme={null}
{
  "Foveus": {
    "ApiKey": "fov_test_...",
    "ServiceName": "orders-api",
    "Environment": "test",
    "Mode": "test"
  }
}
```

### Options-based setup

Use options when you want to configure Foveus directly in code.

```csharp theme={null}
builder.Services.AddFoveus(options =>
{
    options.ApiKey = builder.Configuration["Foveus:ApiKey"];
    options.ServiceName = "orders-api";
    options.Environment = "test";
    options.Mode = "test";
});
```

## Add the middleware

For ASP.NET Core APIs, add the Foveus middleware after building the app.

```csharp theme={null}
app.UseFoveus();
```

The middleware captures HTTP executions and sends telemetry to Foveus.

<Note>
  Place Foveus after middleware that establishes request context, authentication, or correlation IDs if your service depends on those values.
</Note>

## Choose a service name

Use a stable service name that identifies the logical service.

```csharp theme={null}
options.ServiceName = "orders-api";
```

Avoid embedding the deployment environment in the service name.

```csharp theme={null}
// Avoid
options.ServiceName = "orders-api-production";

// Prefer
options.ServiceName = "orders-api";
options.Environment = "production";
options.Mode = "live";
```

This keeps your service data easier to search and compare across environments.

## Set the environment

Use `Environment` for the deployment environment.

Examples:

```text theme={null}
local
development
test
staging
production
```

```csharp theme={null}
options.Environment = "staging";
```

## Set the mode

Use `Mode` for the Foveus data mode.

| Mode   | Use for                                  |
| ------ | ---------------------------------------- |
| `test` | Sandbox, development, QA, and onboarding |
| `live` | Production telemetry                     |

```csharp theme={null}
options.Mode = "test";
```

Use `test` while validating your setup. Use `live` when your service is ready to send production telemetry.

## Store your API key safely

Do not commit API keys to source control.

For local development, use user secrets:

```bash theme={null}
dotnet user-secrets set "Foveus:ApiKey" "fov_test_..."
```

For deployed services, use your hosting provider’s secret manager.

Examples:

* Azure App Configuration or Key Vault
* AWS Secrets Manager
* Google Secret Manager
* Kubernetes secrets
* Render environment variables

## Verify installation

Start your service and call an endpoint.

```bash theme={null}
curl http://localhost:5000/orders
```

Open Foveus and go to **Executions**.

Search by service:

```text theme={null}
service:orders-api
```

If the SDK is configured correctly, you should see recent executions from your service.

## Troubleshooting

### No executions appear

Check that:

* your API key is valid
* your service can reach Foveus
* `ServiceName` is set
* `Mode` matches the dashboard mode you are viewing
* your request reached the middleware
* your selected time range includes the request time

### The service name looks wrong

If you see service names like `orders-api-production`, update your configuration:

```csharp theme={null}
options.ServiceName = "orders-api";
options.Environment = "production";
options.Mode = "live";
```

### Context search does not find a value

Execution Context Search uses indexed execution context. It does not scan arbitrary raw request bodies.

If you recently enabled context indexing, trigger a new request. Newly indexed context applies to new ingested executions.

## Next steps

* Send your first execution: [Send your first execution](/get-started/send-first-execution)
* Learn about executions: [Executions](/concepts/executions)
* Configure the SDK: [SDK configuration](/sdk/configuration)
* Review data safety: [Data safety and retention](/security/data-safety-and-retention)
