# Add an AWS Security Lake source

Adds a Security Lake subscriber as an ingestion source. LangWatch reads the subscriber's SQS queue on `config.schedule` (every 5 minutes by default), decodes each Parquet object, keeps the AI activity (Bedrock, SageMaker endpoints, Bedrock agents) and stores it as OCSF events with `source_type` `security_lake`. The access keys are stored sealed and never returned. LangWatch generates the source's `externalId` and returns it; the subscriber role's trust policy must require it as the `sts:ExternalId` condition.

> Page: https://langwatch.ai/docs/api-reference/governance-security-lake/add-an-aws-security-lake-source
> Source: https://github.com/langwatch/langwatch/blob/main/docs/api-reference/governance-security-lake/add-an-aws-security-lake-source.mdx
> Index of all pages: https://langwatch.ai/docs/llms.txt

## Endpoint

`POST https://app.langwatch.ai/api/v1/governance/security-lake/sources`

## Authentication

### admin_api_key

Admin API key for organization-level operations (managing projects, API keys). Create one in Settings > API Keys or via POST /api/api-keys. Format: sk-lw-{id}_{secret}.

```json
{"id":"admin_api_key","type":"http","scheme":"bearer"}
```

## Request body (required)

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "name": {"type":"string","minLength":1,"maxLength":128},
    "description": {"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},
    "config": {
      "type": "object",
      "properties": {
        "region": {"type":"string","pattern":"^[a-z]{2}(-[a-z]+)+-\\d$"},
        "subscriberRoleArn": {"type":"string","pattern":"^arn:aws[a-z-]*:iam::\\d{12}:role\\/.+$"},
        "queueUrl": {"type":"string","format":"uri"},
        "sources": {
          "default": ["CLOUD_TRAIL_MGMT","S3_DATA","LAMBDA_EXECUTION"],
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string",
            "enum": ["CLOUD_TRAIL_MGMT","S3_DATA","LAMBDA_EXECUTION"]
          }
        },
        "maxMessagesPerRun": {"default":100,"type":"integer","minimum":1,"maximum":1000},
        "maxReceives": {"default":3,"type":"integer","minimum":1,"maximum":20},
        "s3Endpoint": {"type":"string","format":"uri"},
        "sqsEndpoint": {"type":"string","format":"uri"},
        "schedule": {"default":"*/5 * * * *","type":"string"}
      },
      "required": ["region","subscriberRoleArn","queueUrl"]
    },
    "credentials": {
      "type": "object",
      "properties": {
        "aws_access_key_id": {"type":"string","minLength":1},
        "aws_secret_access_key": {"type":"string","minLength":1},
        "aws_session_token": {"type":"string","minLength":1}
      },
      "required": ["aws_access_key_id","aws_secret_access_key"]
    }
  },
  "required": ["name","config","credentials"]
}
```

## Request example

```bash
curl --request POST \
  --url 'https://app.langwatch.ai/api/v1/governance/security-lake/sources' \
  --header "Authorization: Bearer $LANGWATCH_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"name":"string","description":"string","config":{"region":"string","subscriberRoleArn":"string","queueUrl":"string","sources":["CLOUD_TRAIL_MGMT","S3_DATA","LAMBDA_EXECUTION"],"maxMessagesPerRun":100,"maxReceives":3,"s3Endpoint":"string","sqsEndpoint":"string","schedule":"*/5 * * * *"},"credentials":{"aws_access_key_id":"string","aws_secret_access_key":"string","aws_session_token":"string"}}'
```

## Responses

### 200

Success

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "id": {"type":"string"},
    "name": {"type":"string"},
    "status": {"type":"string"},
    "region": {"type":"string"},
    "queueUrl": {"type":"string"},
    "subscriberRoleArn": {"type":"string"},
    "externalId": {"type":"string"},
    "sources": {
      "type": "array",
      "items": {"type":"string","enum":["CLOUD_TRAIL_MGMT","S3_DATA","LAMBDA_EXECUTION"]}
    },
    "schedule": {"type":["string","null"]}
  },
  "required": [
    "id",
    "name",
    "status",
    "region",
    "queueUrl",
    "subscriberRoleArn",
    "externalId",
    "sources",
    "schedule"
  ],
  "additionalProperties": false
}
```

### 400

Bad Request

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

### 401

Unauthorized

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

### 403

Forbidden

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

### 422

Unprocessable Entity

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

### 500

Internal Server Error

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "type": {"type":"string"},
    "code": {"type":"string"},
    "message": {"type":"string"},
    "retryable": {"type":"boolean"},
    "meta": {
      "type": "object",
      "propertyNames": {"type":"string"},
      "additionalProperties": {}
    },
    "trace_id": {"type":"string"},
    "span_id": {"type":"string"},
    "trace": {
      "type": "object",
      "properties": {
        "traceId": {"type":"string"},
        "spanId": {"type":"string"},
        "traceUrl": {"type":"string"},
        "logsUrl": {"type":"string"}
      }
    },
    "tips": {"type":"array","items":{"type":"string"}},
    "docs_url": {"type":"string"},
    "fault": {
      "type": "string",
      "enum": ["customer","platform","provider","presumed_platform"]
    },
    "reasons": {"type":"array","items":{}}
  },
  "required": ["type","code","message","retryable"]
}
```

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.
