# API Configuration

## Learn how to configure the Donobu API, set up GPT configurations, and manage environment variables.

Markdown

note

For a complete list of endpoints and parameters, please refer to the [API Reference](/content/docs/api/index.html).

### GPT Configuration

Before creating AI-powered flows, you need to configure at least one GPT provider. The Donobu API supports multiple AI providers:

#### Supported Providers

- **OpenAI**: GPT-5.1, GPT-4o, and other OpenAI models
- **Anthropic**: Claude 4.5 Sonnet, Claude 4.5 Haiku, and others via direct API
- **Anthropic via AWS Bedrock**: Claude 4.5 Sonnet, Claude 3 Haiku, Claude 3 Opus through AWS
- **Google Gemini**: Gemini 3.0 Pro, Gemini 2.5 Flash
- **Google Vertex AI**: Gemini 3.0 Pro, Gemini 2.5 Flash via Vertex AI

#### Creating a GPT Configuration

```bash
# OpenAI Configuration
curl -X POST http://localhost:31000/api/gpt-configs/openai-gpt5-1 \
-H "Content-Type: application/json" \
-d '{
  "type": "OPENAI",
  "apiKey": "your-openai-api-key",
  "modelName": "gpt-5.1"
}'

# Anthropic Configuration
curl -X POST http://localhost:31000/api/gpt-configs/claude-4-5-sonnet \
-H "Content-Type: application/json" \
-d '{
  "type": "ANTHROPIC",
  "apiKey": "your-anthropic-api-key",
  "modelName": "claude-4-5-sonnet"
}'
```

#### Listing GPT Configurations

```bash
curl -X GET http://localhost:31000/api/gpt-configs
```

### Environment Variables

Environment variables can be used within your flows to store configuration values, API keys, or other data that should not be hardcoded.

#### Setting Environment Variables

```bash
# Set a database URL
curl -X POST http://localhost:31000/api/env/DATABASE_URL \
-H "Content-Type: application/json" \
-d '{
  "value": "postgresql://user:password@localhost:5432/mydb"
}'

# Set a test user email
curl -X POST http://localhost:31000/api/env/TEST_USER_EMAIL \
-H "Content-Type: application/json" \
-d '{
  "value": "test@example.com"
}'
```

#### Using Environment Variables in Flows

When creating a flow, specify which environment variables should be available:

```bash
curl -X POST http://localhost:31000/api/flows \
-H "Content-Type: application/json" \
-d '{
  "name": "Login Test Flow",
  "targetWebsite": "https://app.example.com/login",
  "overallObjective": "Log in using the test credentials",
  "envVars": ["TEST_USER_EMAIL", "TEST_USER_PASSWORD"],
  "initialRunMode": "AUTONOMOUS"
}'
```

### Agent Configuration

Agents are responsible for making decisions during autonomous flows. You can assign specific GPT configurations to different agents.

#### Assigning GPT Configuration to Agent

```bash
# Assign the OpenAI configuration to the flow-runner agent
curl -X POST http://localhost:31000/api/agents/flow-runner \
-H "Content-Type: application/json" \
-d '{
  "gptConfigName": "openai-gpt4"
}'
```

#### Checking Agent Configuration

```bash
curl -X GET http://localhost:31000/api/agents/flow-runner
```

### Browser Configuration

Configure different browser settings for your flows:

#### Device Browser (Local)

```json
{
  "browser": {
    "using": {
      "type": "device",
      "deviceName": "Desktop Chromium",
      "headless": false,
      "proxy": {
        "server": "http://proxy.example.com:8080"
      }
    }
  }
}
```

#### Remote Browser Instance

```json
{
  "browser": {
    "using": {
      "type": "remoteInstance",
      "url": "ws://remote-browser:9222"
    }
  }
}
```

#### BrowserBase Cloud

```json
{
  "browser": {
    "using": {
      "type": "browserBase",
      "sessionArgs": {
        "projectId": "your-browserbase-project-id",
        "browserSettings": {
          "viewport": {
            "width": 1920,
            "height": 1080
          },
          "blockAds": true,
          "solveCaptchas": true
        },
        "timeout": 300,
        "region": "us-east-1"
      }
    }
  }
}
```

### API Authentication

The Donobu API runs locally and does not require authentication when accessed from localhost. However, ensure that:

1. Only trusted applications have access to your local machine
2. Environment variables containing sensitive data are properly managed
3. GPT API keys are stored securely

### Error Handling

The API returns standardized error responses:

```json
{
  "code": "FLOW_NOT_FOUND",
  "message": "A flow with the specified ID was not found."
}
```

Common error codes:

- `FLOW_NOT_FOUND`: The specified flow ID does not exist
- `INVALID_REQUEST`: Request body or parameters are malformed
- `GPT_CONFIG_NOT_FOUND`: The specified GPT configuration does not exist
- `FLOW_STILL_RUNNING`: Cannot delete or modify a running flow
