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

# SDK Recipes Overview

> Worked Python examples that use the Validio SDK to query and change resources through the Validio API.

Each recipe is a complete Python example that solves one task with the [Validio SDK](https://docs.validio.io/developer/validio-sdk.md). Every recipe has the same three parts:

* **Overview:** What the recipe does, and when it's useful.
* **Steps:** A walkthrough of the code, one part at a time.
* **Full code sample:** The complete script, ready to copy. Where it helps, an example response follows.

To install the SDK and set up your credentials first, see [Getting started](https://docs.validio.io/developer/getting-started.md). The recipes create the client without arguments, so it finds your credentials automatically. See [How the CLI and SDK find credentials](https://docs.validio.io/developer/getting-started/authentication.md#how-the-cli-and-sdk-find-credentials). Where a recipe reads an ID from an environment variable, such as `EXAMPLE_SOURCE_ID`, set it or substitute your own value.

> [!NOTE]
>
> The client is asynchronous, so the example functions are `async`. To call one from synchronous code, wrap it in `asyncio.run`. See [Synchronous or asynchronous](https://docs.validio.io/developer/validio-sdk.md#synchronous-or-asynchronous).

## Recipes

> **[Create a credential and source](https://docs.validio.io/developer/validio-sdk/sdk-recipes/create-a-credential-and-source.md)**
>
> Create a credential, infer a schema, and create a source.

> **[Create a namespace and a tag](https://docs.validio.io/developer/validio-sdk/sdk-recipes/create-a-namespace-and-tag.md)**
>
> Create a namespace to hold resources, and a tag to label them.

> **[Delete a credential](https://docs.validio.io/developer/validio-sdk/sdk-recipes/delete-a-credential.md)**
>
> Delete a credential with a mutation and variables.

> **[Export incident groups to CSV](https://docs.validio.io/developer/validio-sdk/sdk-recipes/export-incident-groups-to-csv.md)**
>
> Page through a source's incident groups and export their incidents.

> **[Export metrics to CSV](https://docs.validio.io/developer/validio-sdk/sdk-recipes/export-metrics-to-csv.md)**
>
> Export a validator segment's metrics to CSV, one day at a time.

> **[Get incidents for a validator](https://docs.validio.io/developer/validio-sdk/sdk-recipes/get-incidents-for-a-validator.md)**
>
> Query a validator's incidents by its resource name.

> **[Get info for a validator](https://docs.validio.io/developer/validio-sdk/sdk-recipes/get-info-for-a-validator.md)**
>
> Fetch a validator's details and related resources with fragments.

> **[List credentials](https://docs.validio.io/developer/validio-sdk/sdk-recipes/list-credentials.md)**
>
> List all credentials with their name and type, using an alias.

> **[Manually poll a source and its validators](https://docs.validio.io/developer/validio-sdk/sdk-recipes/manually-poll-a-source-and-its-validators.md)**
>
> Poll a source and stop a pipeline when new incidents appear.

> **[Number of incidents by severity](https://docs.validio.io/developer/validio-sdk/sdk-recipes/number-of-incidents-by-severity.md)**
>
> Count a source's incidents by severity over the past week.

> **[Set up a channel and notification rule](https://docs.validio.io/developer/validio-sdk/sdk-recipes/set-up-a-channel-and-notification-rule.md)**
>
> Create a Slack channel and a rule that sends alerts on it.

> **[Update a source schema](https://docs.validio.io/developer/validio-sdk/sdk-recipes/update-a-source-schema.md)**
>
> Re-infer, verify, and update a source's schema.

> **[Update a validator](https://docs.validio.io/developer/validio-sdk/sdk-recipes/update-a-validator.md)**
>
> Update a validator's name and dynamic threshold in one mutation.

> **[Using the SDK with IaC](https://docs.validio.io/developer/validio-sdk/sdk-recipes/using-the-sdk-with-iac.md)**
>
> Reuse an existing validator's threshold in Validio Code.
