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

# Connect via API

> Make your first call to the Symphony API in a few minutes.

## What it is

This quickstart gets you to your first call to the **Symphony** API in a few minutes. The API lets systems, scripts, and automations use your company's models, agents, and knowledge bases without going through the interface.

After this quickstart, continue to:

<CardGroup cols={2}>
  <Card title="Building projects with the API" icon="hammer" href="/en/desenvolvedores/api/projetos-com-a-api">
    Complete guide, with recipes.
  </Card>

  <Card title="API reference" icon="book-open" href="/en/desenvolvedores/api/referencia-da-api">
    All available endpoints, with parameters and responses.
  </Card>

  <Card title="Errors and limits" icon="triangle-exclamation" href="/en/desenvolvedores/api/erros-e-limites">
    How to handle failures.
  </Card>

  <Card title="Environments and support" icon="life-ring" href="/en/desenvolvedores/api/ambientes-e-suporte">
    Where to test and how to get help.
  </Card>
</CardGroup>

## Prerequisites

* An active **AI Symphony** account.
* An **API key** (starts with `sk-`).
* Your **company ID**, for the `X-Enterprise-Id` header.

## Step 1 — Generate the API key

<Steps>
  <Step title="Open AI Symphony">
    Go to [symphony.fcamara.com](https://symphony.fcamara.com/).
  </Step>

  <Step title="Click your username">
    In the bottom-left corner.
  </Step>

  <Step title="Go to Settings" />

  <Step title="Open the Account tab (or Connections, depending on the version)">
    Open **API keys**.
  </Step>

  <Step title="Create and copy the key">
    Click **API key** and **copy** the generated key. It starts with `sk-`.
  </Step>
</Steps>

<Tip>Paste the **complete** key, with no extra spaces or quotes.</Tip>

<Warning>
  **Each user has a single key.** Generating a new one replaces the previous one immediately, and every integration that used the old key stops working.
</Warning>

## Step 2 — Find your company ID

Symphony serves several companies, and each has its own catalog of models, agents, and knowledge bases. The key doesn't carry this information, so you specify the company on every call with the `X-Enterprise-Id` header.

Ask **your company's Symphony administrator** for this ID.

<Note>
  Without this header, you get "model not found" for a model that works fine in the interface.
</Note>

## Step 3 — Make your first call

Every call uses the same three headers:

| Header | Value |
| - | - |
| `Authorization` | `Bearer sk-...` (your key) |
| `X-Enterprise-Id` | Your company ID |
| `Content-Type` | `application/json` (when there's a JSON body) |

<Info>
  **You don't need cookies or a CSRF token.** Those steps only apply to the browser. Integrations that use an API key skip them.
</Info>

**Base URL:** `https://symphony.fcamara.com`

### List the models you can use

```bash theme={null}
curl https://symphony.fcamara.com/api/models \
  -H "Authorization: Bearer sk-..." \
  -H "X-Enterprise-Id: YOUR_COMPANY_ID"
```

Copy the `id` of one of the returned items. That's the value that goes in the `model` field.

### Send a message

```bash theme={null}
curl -X POST https://symphony.fcamara.com/api/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -H "X-Enterprise-Id: YOUR_COMPANY_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "azure.gpt-5-chat",
    "messages": [
      { "role": "user", "content": "Explain what an API is in two sentences." }
    ]
  }'
```

Response (`200 OK`), in OpenAI format:

```json theme={null}
{
  "id": "chatcmpl-DXttDwwlWkL6YkzARekAPP2cuFUX2",
  "object": "chat.completion",
  "model": "azure.gpt-5-chat",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": { "role": "assistant", "content": "An API is..." }
    }
  ],
  "usage": { "prompt_tokens": 24, "completion_tokens": 61, "total_tokens": 85 }
}
```

<Tip>
  **Only `model` and `messages` are required.** The `id`, `chat_id`, and `session_id` fields are used by the interface and are only needed if you want to save the conversation in Symphony's history.
</Tip>

## Python example

The API is compatible with OpenAI's. With the official `openai` library, just change the URL and the key. Without a library, use `requests`:

<CodeGroup>
  ```python openai theme={null}
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["SYMPHONY_API_KEY"],
      base_url="https://symphony.fcamara.com/api",
      default_headers={"X-Enterprise-Id": os.environ["SYMPHONY_ENTERPRISE_ID"]},
  )

  response = client.chat.completions.create(
      model="azure.gpt-5-chat",
      messages=[{"role": "user", "content": "Explain what an API is."}],
  )
  print(response.choices[0].message.content)
  print(f"Tokens used: {response.usage.total_tokens}")
  ```

  ```python requests theme={null}
  import os
  import requests

  response = requests.post(
      "https://symphony.fcamara.com/api/chat/completions",
      headers={
          "Authorization": f"Bearer {os.environ['SYMPHONY_API_KEY']}",
          "X-Enterprise-Id": os.environ["SYMPHONY_ENTERPRISE_ID"],
          "Content-Type": "application/json",
      },
      json={
          "model": "azure.gpt-5-chat",
          "messages": [{"role": "user", "content": "Explain what an API is."}],
      },
      timeout=(10, 300),
  )

  if response.ok:
      print(response.json()["choices"][0]["message"]["content"])
  else:
      error = response.json().get("error", {})
      print(response.status_code, error.get("code"), error.get("request_id"))
  ```
</CodeGroup>

## Most common issues when starting out

| Symptom | Likely cause | What to do |
| - | - | - |
| `401` | Incomplete key, missing the `Bearer` prefix, or replaced by a new one | Check the `Authorization: Bearer sk-...` header |
| `403` | API key disabled in the environment, or no permission | Contact your company's administrator |
| `404` with `MODEL_UNAVAILABLE` | `X-Enterprise-Id` missing/wrong, or `model` mistyped | Send the header and copy the `id` from `GET /api/models` |
| `402` | Your monthly usage limit ran out | Contact the administrator. Retrying won't help |
| `429` | Too many requests in a short time | Wait for the time in the `Retry-After` header and try again |

The full list is in [Errors and limits](/en/desenvolvedores/api/erros-e-limites).

## Security best practices

* Store the key in an **environment variable** or secrets vault.
* **Never** put the key in code that runs in the browser, in a repository, in a URL, or in a log.
* Always use **HTTPS**.
* For production integrations, ask the administrator for a **dedicated technical account**. That way, generating a new personal key doesn't break the automation.

## Frequently asked questions

<AccordionGroup>
  <Accordion title="Which model should I use in the model field?">
    One of the `id` values returned by `GET /api/models`. Agents created on the platform also appear in this list and can be used the same way.
  </Accordion>

  <Accordion title="Do I need X-Enterprise-Id?">
    Yes, on every call.
  </Accordion>

  <Accordion title="Do I need a CSRF token or cookies?">
    No. With an API key, the `Authorization` header is enough.
  </Accordion>

  <Accordion title="Does the key expire?">
    No. It only stops working if you generate another one or it's revoked.
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.