---
title: "Create connected account"
url: https://hexelstudio.com/docs/api/titan/connections/create-connected-account
---

# Create connected account

**POST** `/titan/tools/connected-accounts`

Create a new connected account with encrypted credentials

Requires permission `tool-gateway:auth:write`.

## Headers

- `Authorization: string`

  `Bearer <token>`. A Hexel Studio access token for a member or a service user of your organization (or send a service user's API key as X-API-Key).

- `X-Workspace-Id: optional string`

  Workspace scope used by permission checks, if applicable.

- `X-Environment-Id: optional string`

  Optional environment scope.

## Body parameters

- `account: optional ConnectedAccount`

  - `account_email: optional string`

  - `account_name: optional string`

  - `attributes: optional map[string]`

    Attributes are non-secret connection attributes, only the names
reserves for per-tenant hosts (site, subdomain, region,
instance_url): values a token response maps (Salesforce instance_url)
and the non-secret credential fields of those names. They are derived,
never caller-supplied, never a token, and nothing routes on them yet.

  - `auth_config_id: optional string`

  - `connected_account_id: optional string`

  - `created_at: optional string`

  - `destination_boundaries: optional array of string`

    DestinationBoundaries carries administrator-assigned destination scope in
canonical "type:id" form (e.g. "github.organization:acme"). A Titan grant's
required boundaries must all be present here for the connection to be eligible.

  - `environment_id: optional string`

  - `expires_at: optional string`

  - `external_account_id: optional string`

  - `nano_id: optional string`

  - `organization_id: optional string`

  - `permissions: optional array of string`

    Permissions are normalized permissions derived from granted scopes at connect
time (e.g. "repo"); a grant's required_permissions must be a subset.

  - `principal_type: optional string`

    PrincipalType is the destination-principal class this connection represents
(e.g. "oauth_user", "mcp_credential"). It must be one of a grant's principal_types.

  - `priority: optional integer`

  - `status: optional string`

  - `tags: optional array of string`

    Tags are administrator-assigned labels; a grant's required_tags must be a subset.

  - `toolkit_slug: optional string`

  - `updated_at: optional string`

  - `workspace_id: optional string`

- `credentials: optional DecryptedCredentials`

  - `access_token: optional string`

  - `api_key: optional string`

    api_key grant

  - `auth0_jwt: optional string`

    jwt-bearer grant

  - `client_id: optional string`

    client_credentials

  - `client_secret: optional string`

    client_credentials

  - `fields: optional map[string]`

    Fields are a static-token connection's named credential fields, as its
auth config declares them. They are stored inside the same
encrypted envelope as the rest of this struct. A connection without
declared fields holds AccessToken instead.

  - `grant_type: optional string`

    STS grant inputs (Hexel token-exchange). These are stored encrypted in
connected_accounts.credentials and used to obtain a short-lived bearer
from the STS endpoint. Only populated for hexel_sts auth configs.

  - `refresh_token: optional string`

## Returns

`201` Created (`ConnectedAccount`)

- `account_email: optional string`

- `account_name: optional string`

- `attributes: optional map[string]`

  Attributes are non-secret connection attributes, only the names
reserves for per-tenant hosts (site, subdomain, region,
instance_url): values a token response maps (Salesforce instance_url)
and the non-secret credential fields of those names. They are derived,
never caller-supplied, never a token, and nothing routes on them yet.

- `auth_config_id: optional string`

- `connected_account_id: optional string`

- `created_at: optional string`

- `destination_boundaries: optional array of string`

  DestinationBoundaries carries administrator-assigned destination scope in
canonical "type:id" form (e.g. "github.organization:acme"). A Titan grant's
required boundaries must all be present here for the connection to be eligible.

- `environment_id: optional string`

- `expires_at: optional string`

- `external_account_id: optional string`

- `nano_id: optional string`

- `organization_id: optional string`

- `permissions: optional array of string`

  Permissions are normalized permissions derived from granted scopes at connect
time (e.g. "repo"); a grant's required_permissions must be a subset.

- `principal_type: optional string`

  PrincipalType is the destination-principal class this connection represents
(e.g. "oauth_user", "mcp_credential"). It must be one of a grant's principal_types.

- `priority: optional integer`

- `status: optional string`

- `tags: optional array of string`

  Tags are administrator-assigned labels; a grant's required_tags must be a subset.

- `toolkit_slug: optional string`

- `updated_at: optional string`

- `workspace_id: optional string`

## Errors

- `400` Bad Request
- `401` Unauthenticated: token missing or rejected at the edge
- `403` Forbidden: caller lacks the required permission
- `500` Internal Server Error

## Example

```bash
curl --request POST \
  --url 'https://api.hexelstudio.com/v1/titan/tools/connected-accounts' \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  "account": {
    "account_email": "string",
    "account_name": "string",
    "attributes": {
      "key": "string"
    },
    "auth_config_id": "string",
    "connected_account_id": "string",
    "created_at": "2026-01-01T00:00:00Z",
    "destination_boundaries": [
      "string"
    ],
    "environment_id": "string",
    "expires_at": "2026-01-01T00:00:00Z",
    "external_account_id": "string",
    "nano_id": "string",
    "organization_id": "string",
    "permissions": [
      "string"
    ],
    "principal_type": "string",
    "priority": 0,
    "status": "string",
    "tags": [
      "string"
    ],
    "toolkit_slug": "string",
    "updated_at": "2026-01-01T00:00:00Z",
    "workspace_id": "string"
  },
  "credentials": {
    "access_token": "string",
    "api_key": "string",
    "auth0_jwt": "string",
    "client_id": "string",
    "client_secret": "string",
    "fields": {
      "key": "string"
    },
    "grant_type": "string",
    "refresh_token": "string"
  }
}'
```

### Response (201)

```json
{
  "account_email": "string",
  "account_name": "string",
  "attributes": {
    "key": "string"
  },
  "auth_config_id": "string",
  "connected_account_id": "string",
  "created_at": "2026-01-01T00:00:00Z",
  "destination_boundaries": [
    "string"
  ],
  "environment_id": "string",
  "expires_at": "2026-01-01T00:00:00Z",
  "external_account_id": "string",
  "nano_id": "string",
  "organization_id": "string",
  "permissions": [
    "string"
  ],
  "principal_type": "string",
  "priority": 0,
  "status": "string",
  "tags": [
    "string"
  ],
  "toolkit_slug": "string",
  "updated_at": "2026-01-01T00:00:00Z",
  "workspace_id": "string"
}
```

### Response (400)

```json
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
```

### Response (500)

```json
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
```
