Skip to content

Models

Example showing how to list and get synthetic data models in a project.

This example assumes using Gretel; is in scope and apiKey contains your Gretel API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
// List all synthetic data models in a project.
using var client = new GretelClient(apiKey);

var projects = await client.Projects.ListProjectsAsync(limit: 1);
if (projects.Data is not { Count: > 0 })
{
    return;
}

var projectId = projects.Data[0].Uid ?? projects.Data[0].Name!;
var models = await client.Projects.ListModelsAsync(
    projectId: projectId,
    limit: 10);