> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentflow.live/llms.txt
> Use this file to discover all available pages before exploring further.

# Importing & Exporting AI Connection Configurations

> Share and backup your AI connection configurations using YAML files

# Importing & Exporting AI Connection Configurations

**Share AI connection configurations across organizations or create backups with YAML files.**

## Overview

Export your AI connection configurations as YAML files to:

* **Share** AI connection setups with team members or other organizations
* **Backup** important configurations
* **Document** your AI connection architecture
* **Template** common configurations for reuse

<Warning>
  **Security Note:** Exported configurations **never include sensitive data**. API keys and header values are excluded for security.
</Warning>

## Exporting an AI Connection Configuration

### Step-by-Step Export

1. Navigate to **Admin Dashboard** → **AI Connections** tab
2. Find the AI connection you want to export
3. **Hover** over the connection card
4. Click the **Download icon** (↓)
5. YAML file downloads automatically

**Filename format:** `{connection-name}-config-{date}.yaml`

### What Gets Exported

✅ **Included:**

* AI connection name and description
* API endpoint URL
* HTTP method (POST, GET, etc.)
* **Header keys** (without values)
* Request schema/body structure
* Response path configuration
* Message formatting rules
* Suggestion prompts

❌ **Never Exported (Security):**

* API keys
* Authentication tokens
* Header values (only keys are exported)
* Credentials of any kind

### Example Export

```yaml theme={null}
name: "Claude Sonnet"
model_id: "claude-3-sonnet-20240229"
description: "Large model for reasoning tasks"
endpoint: "https://api.anthropic.com/v1/messages"
method: "POST"

headers:
  x-api-key:          # Value not included
  anthropic-version:  # Value not included
  Content-Type:       # Value not included

request_schema:
  model: "claude-3-sonnet-20240229"
  messages:
    - role: "user"
      content: "{{message}}"
  max_tokens: 4096

response_path: "content[0].text"

message_format:
  preset: "openai"
  mapping:
    role:
      source: "role"
      target: "role"
      transform: "none"
    content:
      source: "content"
      target: "content"
      transform: "none"

suggestion_prompts:
  - "Tell me about your capabilities"
  - "How can you help me today?"
```

<Info>
  Notice that header values are **empty** - only the keys are included to show what headers are required.
</Info>

## Importing an AI Connection Configuration

### Step-by-Step Import

1. Navigate to **Admin Dashboard** → **AI Connections** tab
2. Click the **Import** button (top-right)
3. **Upload** your YAML file:
   * Drag and drop, or
   * Click to browse files
4. Click **Validate** to check the configuration
5. Review any validation errors
6. Click **Import AI Connection** to create the connection

### After Import: Required Steps

<Steps>
  <Step title="Add API Keys">
    Navigate to the imported AI connection settings and add the required API key
  </Step>

  <Step title="Configure Headers">
    Fill in header values that were excluded from the export:

    * Authentication tokens
    * API versions
    * Content types
  </Step>

  <Step title="Test the Connection">
    Send a test message to verify the configuration works correctly
  </Step>
</Steps>

### Import Options

<AccordionGroup>
  <Accordion title="Replace if exists" icon="arrows-rotate">
    Enable this option to **update** an existing AI connection with the same name instead of creating a duplicate.

    * ✅ Useful for updating configurations
    * ⚠️ Will overwrite existing settings
  </Accordion>

  <Accordion title="Import API key" icon="key">
    This option is **currently not available** for security reasons.

    * API keys must be added manually after import
    * This prevents accidental credential sharing
  </Accordion>
</AccordionGroup>

### Validation Errors

Common validation errors and solutions:

<AccordionGroup>
  <Accordion title="Invalid YAML syntax" icon="code">
    **Error:** YAML parsing failed

    **Solution:** Validate your YAML file with a YAML validator before importing
  </Accordion>

  <Accordion title="Missing required fields" icon="circle-exclamation">
    **Error:** Required field is missing

    **Solution:** Ensure these required fields are present:

    * `name`
    * `endpoint`
    * `request_schema`
    * `response_path`
    * `message_format`
  </Accordion>

  <Accordion title="Invalid endpoint URL" icon="link">
    **Error:** Invalid endpoint URL

    **Solution:** Ensure endpoint is a valid HTTPS URL
  </Accordion>

  <Accordion title="Duplicate connection name" icon="copy">
    **Error:** AI connection with this name already exists

    **Solution:** Either:

    * Enable "Replace if exists" option, or
    * Change the AI connection name in your YAML file
  </Accordion>
</AccordionGroup>

## Sharing Configurations

### Sharing Best Practices

<Steps>
  <Step title="Export the AI connection">
    Download the YAML configuration file
  </Step>

  <Step title="Review the file">
    Verify no sensitive data is included (it shouldn't be, but always check)
  </Step>

  <Step title="Share securely">
    Send the YAML file via:

    * Email
    * Slack/Teams
    * Git repository
    * Documentation
  </Step>

  <Step title="Provide credentials separately">
    Send API keys and header values through a secure channel:

    * Password manager
    * Secure credential sharing service
    * Encrypted communication
  </Step>
</Steps>

<Warning>
  **Never** send API keys or credentials in the same channel as the configuration file!
</Warning>

## Use Cases

### Team Collaboration

Share successful AI connection configurations with your team:

```yaml theme={null}
# marketing-assistant.yaml
name: "Marketing Content Assistant"
description: "Specialized for creating marketing content"
# ... rest of configuration
```

Team members can import and use immediately (after adding their API keys).

### Environment Migration

Move configurations between environments:

1. **Development** → Export configuration
2. **Staging** → Import and test
3. **Production** → Import verified configuration

### Configuration Templates

Create templates for common AI connection types:

* **Customer Support Bot** - Pre-configured for support scenarios
* **Code Assistant** - Optimized for code generation
* **Content Writer** - Tuned for creative writing

### Backup & Disaster Recovery

Regular backups of critical configurations:

1. Export all AI connections weekly
2. Store in version control
3. Quick recovery if needed

## Security Considerations

### What's Protected

<CardGroup cols={2}>
  <Card title="Never Exported" icon="shield">
    * API keys
    * Authentication tokens
    * Header values
    * Credentials
    * Secrets
  </Card>

  <Card title="Always Exported" icon="file">
    * AI connection name
    * Endpoint URL
    * Header keys
    * Request structure
    * Configuration settings
  </Card>
</CardGroup>

### Security Best Practices

✅ **Do:**

* Review exported files before sharing
* Share credentials separately and securely
* Use version control for configuration files
* Document which API keys are needed

❌ **Don't:**

* Manually add API keys to YAML files
* Share configuration and credentials together
* Commit credentials to git repositories
* Share files publicly without review

## Troubleshooting

<AccordionGroup>
  <Accordion title="Export doesn't work" icon="download">
    **Symptoms:** Download doesn't start or fails

    **Solutions:**

    * Check browser console for errors
    * Verify you have permission to access the AI connection
    * Try a different browser
    * Ensure AI connection exists in database
  </Accordion>

  <Accordion title="Import validation fails" icon="triangle-exclamation">
    **Symptoms:** Validation errors during import

    **Solutions:**

    * Check error messages for specific issues
    * Validate YAML syntax with online validator
    * Ensure all required fields are present
    * Verify endpoint URL is valid HTTPS
  </Accordion>

  <Accordion title="Connection doesn't work after import" icon="circle-xmark">
    **Symptoms:** Imported AI connection fails to respond

    **Solutions:**

    * Verify API key was added correctly
    * Check all header values are filled in
    * Test the endpoint URL directly
    * Review request schema format
  </Accordion>

  <Accordion title="Can't find header values" icon="magnifying-glass">
    **Symptoms:** Don't know what values to use for headers

    **Solutions:**

    * Check API provider documentation
    * Review the original model configuration
    * Contact person who shared the config
    * Check with API provider support
  </Accordion>
</AccordionGroup>

<Card title="Next: Test Your Agents" href="/agents/testing-agents">
  Learn how to properly test imported AI connection configurations
</Card>
