Discover how to list your prompts. You can retrieve all prompts in your workspace or filter them by feature.

List all prompts

You can list all prompts in your workspace with a single line of code.

const { value } = await basalt.prompt.list()

List prompts in a specific feature

You can retrieve prompts from a specific feature by providing the feature slug.

// Using object syntax
const { value } = await basalt.prompt.list({
  featureSlug: 'onboarding'
})

Returned data

When you list prompts, the SDK returns an array of prompt metadata objects.

interface PromptListResponse {
  slug?: string;
  status: 'live' | 'draft';
  name: string;
  description?: string;
  availableVersions: string[];
  availableTags: string[];
}

Example response

Response example
[
  {
    "slug": "welcome-message",
    "status": "live",
    "name": "Welcome Message",
    "description": "A friendly welcome message for new users",
    "availableVersions": ["1.0.0", "1.1.0", "2.0.0"],
    "availableTags": ["production", "staging"]
  },
  {
    "slug": "help-guide",
    "status": "draft",
    "name": "Help Guide",
    "description": "Comprehensive help documentation",
    "availableVersions": ["0.1.0"],
    "availableTags": ["development"]
  }
]

Error handling

Discover how to properly handle errors coming from the SDK and/or the API by checking the Error Handling documentation