Cobbl
CobblAdminClient

Overview

Server-side client for running prompts with the Cobbl SDK

The CobblAdminClient is designed for server-side operations that require authentication. Use this client when you need to execute prompts on behalf of your users.

When to Use CobblAdminClient

  • Running prompts with variables
  • Accessing prompt metadata and version information
  • Server-side applications (Node.js, Next.js API routes, Express)
  • Any context where you can securely store your API key

Installation

npm install @cobbl-ai/sdk

Getting Your API Key

1

Log in to the Dashboard

Visit the Cobbl Dashboard and sign in to your account.

2

Navigate to API Keys

Go to SettingsAPI Keys in the sidebar.

3

Create a New Key

Click Create API Key and give it a descriptive name.

4

Copy Your Key

Copy the generated key - you won't be able to see it again!

Environment Variables

We recommend storing your API key in environment variables:

.env
COBBL_API_KEY=your_api_key_here

Initialization

import { CobblAdminClient } from '@cobbl-ai/sdk'

const adminClient = new CobblAdminClient({
  apiKey: process.env.COBBL_API_KEY,
})

Configuration Options

OptionTypeRequiredDefaultDescription
apiKeystringYes-Your Cobbl API key

Methods

runPrompt

Execute a prompt with the given input variables.

const result = await adminClient.runPrompt(promptSlug, input)
ParameterTypeDescription
promptSlugstringThe unique slug identifier for the prompt
inputPromptInputObject containing variables to fill the prompt

See Running Prompts for detailed usage examples.

Import Patterns

Namespaced Import

For optimal tree-shaking and bundle size:

import { CobblAdminClient } from '@cobbl-ai/sdk'

Next Steps

On this page