Quick Start

Get up and running with Prompt Forge in minutes. This guide will walk you through creating your first prompt and executing it via the API.

This guide assumes you have already created an account and are logged into the Prompt Forge dashboard.

Step 1: Create an API Key

Navigate to your user menu in the bottom-right corner and select API Keys. Click Create New Key to generate your authentication token.

Store your API key securely. It won't be shown again after creation.
Set your API key as an environment variable
bash
export PROMPTFORGE_API_KEY="your-api-key-here"

Step 2: Create Your First Prompt

You can create a prompt through the web interface or directly via the GraphQL API. Here's how to create one using the API:

Create a Prompt
graphql
mutation CreatePrompt {
  createPrompt(input: {
    name: "sentiment-analyzer"
    description: "Analyzes sentiment of product reviews"
    category: ANALYSIS
    isPublic: false
  }) {
    id
    name
    createdAt
  }
}

After creating the prompt, you'll need to add a version with the actual template content:

Create Prompt Version
graphql
mutation CreatePromptVersion {
  createPromptVersion(input: {
    promptId: "cm1234567890"
    content: """
You are a sentiment analysis expert. Analyze the following product review and provide:
1. Overall sentiment (Positive, Negative, or Neutral)
2. Confidence score (0-1)
3. Key phrases that influenced your decision

Review: {{review}}
"""
    params: {
      model: "claude-3-5-sonnet-20241022"
      temperature: 0.3
      max_tokens: 500
    }
    inputSchema: {
      type: "object"
      properties: {
        review: {
          type: "string"
          description: "The product review to analyze"
        }
      }
      required: ["review"]
    }
  }) {
    id
    version
    content
  }
}

Step 3: Execute the Prompt

Now you can execute your prompt by providing the required input variables:

Execute Prompt Request
graphql
mutation ExecutePrompt {
  executePrompt(
    promptId: "cm1234567890"
    input: {
      review: "This product is amazing! Best purchase I've made all year."
    }
  ) {
    output
    latencyMs
    tokenIn
    tokenOut
    costUsd
    executionId
  }
}

The API will return the AI-generated analysis along with execution metrics:

Response
json
{
  "data": {
    "executePrompt": {
      "output": "1. Overall sentiment: Positive\n2. Confidence score: 0.97\n3. Key phrases:\n   - 'amazing'\n   - 'Best purchase'\n   - 'all year'",
      "latencyMs": 1420,
      "tokenIn": 87,
      "tokenOut": 45,
      "costUsd": "0.0018",
      "executionId": "exec_abc123"
    }
  }
}

Step 4: Making Authenticated Requests

All API requests must include your API key in the Authorization header:

Using cURL
bash
curl -X POST https://api.promptforge.sh/v1 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "mutation { executePrompt(...) { ... } }"
  }'
Using JavaScript
typescript
const response = await fetch('https://api.promptforge.sh/v1', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    query: `
      mutation ExecutePrompt($promptId: ID!, $input: JSON!) {
        executePrompt(promptId: $promptId, input: $input) {
          output
          latencyMs
          costUsd
        }
      }
    `,
    variables: {
      promptId: 'cm1234567890',
      input: { review: 'Great product!' }
    }
  })
});

const { data } = await response.json();
console.log(data.executePrompt.output);

Next Steps

Build Chains

Combine multiple prompts into powerful multi-step workflows

Learn about Chains →

Explore the API

Browse the complete GraphQL schema and all available operations

API Reference →

Intent Routing

Automatically route messages to the right chain using AI

Routing Guide →

View Examples

See real-world examples and common patterns

Browse Examples →