> This page is for API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.eon.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.eon.io/_mcp/server.

# Connect Source AWS Organizational Unit

POST https://%7Baccount-domain%7D.console.eon.io/api/v1/projects/{projectId}/source-aws-organizational-units
Content-Type: application/json

Connects an AWS organizational unit to the given project.

All current and future descendant AWS accounts within the organizational unit are discovered and available for backup.


Reference: https://docs.eon.io/api/api-reference/source-connections/source-aws-ous/connect-source-aws-organizational-unit

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `projectId` (string, required) — ID of the project you want to connect the AWS organizational unit to. You can get your project ID from the [API Credentials](https://console.eon.io/global-management/api-credentials) page in your global management console.

### Body (application/json)

This endpoint expects a ConnectSourceAwsOrganizationalUnitRequest.

- `roleArn` (string, required) — ARN of the role Eon assumes to access the organizational unit in AWS.
- `providerOrganizationalUnitId` (string, required) — AWS-assigned organizational unit ID.

## Response

### 200

AWS organizational unit connected.

- `organizationalUnit` (SourceAwsOrganizationalUnit, required) — The connected AWS organizational unit.

## Errors

### 409 Conflict Error

AWS organizational unit already exists in Eon.

- `any`

## Types

### SourceAwsOrganizationalUnit

- `id` (string, required) — Eon-assigned organizational unit ID.
- `roleArn` (string, required) — ARN of the role Eon assumes to access the organizational unit in AWS.
- `name` (string, required) — Organizational unit display name in Eon.
- `providerOrganizationalUnitId` (string, required) — AWS-assigned organizational unit ID.
- `providerManagementAccountId` (string, required) — AWS-assigned ID of the organization's management account.
- `status` (enum, required) — Connection status of the organizational unit. Only `CONNECTED` organizational units can have their accounts backed up.
  - Allowed values: `CONNECTED`, `DISCONNECTED`, `INSUFFICIENT_PERMISSIONS`, `ACCOUNT_STATUS_UNSPECIFIED`

## Examples

**Request**

```json
{
  "roleArn": "arn:aws:iam::123412341234:role/EonSourceAccountRole",
  "providerOrganizationalUnitId": "ou-a1b2-f6g7h111"
}
```

**Response**

```json
{
  "organizationalUnit": {
    "id": "fc495499-9796-5fc9-ade7-1ba924cbcc42",
    "roleArn": "arn:aws:iam::123412341234:role/EonSourceAccountRole",
    "name": "prod-eu organizational unit",
    "providerOrganizationalUnitId": "ou-a1b2-f6g7h111",
    "providerManagementAccountId": "123456789012",
    "status": "CONNECTED"
  }
}
```

**SDK Code**

```python
import requests

url = "https://{account-domain}.console.eon.io/api/v1/projects/cc4fe8ee-0c62-56f2-9fda-f27bc7753e55/source-aws-organizational-units"

payload = {
    "roleArn": "arn:aws:iam::123412341234:role/EonSourceAccountRole",
    "providerOrganizationalUnitId": "ou-a1b2-f6g7h111"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://{account-domain}.console.eon.io/api/v1/projects/cc4fe8ee-0c62-56f2-9fda-f27bc7753e55/source-aws-organizational-units';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"roleArn":"arn:aws:iam::123412341234:role/EonSourceAccountRole","providerOrganizationalUnitId":"ou-a1b2-f6g7h111"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://{account-domain}.console.eon.io/api/v1/projects/cc4fe8ee-0c62-56f2-9fda-f27bc7753e55/source-aws-organizational-units")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"roleArn\": \"arn:aws:iam::123412341234:role/EonSourceAccountRole\",\n  \"providerOrganizationalUnitId\": \"ou-a1b2-f6g7h111\"\n}")
  .asString();
```