[Tenjin API Reference](https://api-docs.tenjin.com/llms.txt) › [Cloud Data Exporter API](https://api-docs.tenjin.com/cloud-data-exporter-api.md) › Get the bucket policy

- Cloud Data Exporter API OpenAPI spec: https://api-docs.tenjin.com/openapi/cloud-data-exporter-api.json

# Get the bucket policy

- **Method:** `GET`
- **Path:** `/v1/bucket_policy`
- **Operation ID:** `get_bucket_policy`
- **Tags:** Bucket policy

The bucket policy to add before creating a config: two statements that let Tenjin's session for your organization write and list under your prefix, or under the config's own folder when it has no prefix. Pass the bucket, prefix and name the config will have, and the document names them.

## Effective servers

- `https://api.tenjin.com/cloud_data_exporter`

## Authentication

- **Bearer**: HTTP bearer (`JWT`)

  Generate an access token on the [Access Tokens](https://dashboard.tenjin.com/dashboard/access_tokens) page of the Tenjin dashboard and send it as `Authorization: Bearer <access token>`. [API access tokens](https://tenjin.com/docs/api-access-tokens/) explains them.

## Query parameters

- **`bucket`**: `string`

  S3 bucket the config will write to
- **`prefix`**: `string`

  S3 key prefix the config will have. Omit it for a config with no prefix
- **`name`**: `string`

  Name the config will have

## Responses

### 200 The bucket policy to add before creating a config

**Content type:** `application/json`

schema: `CloudDataExporterBucketPolicy`

- **`bucket_policy` (required)**: `object`

  The bucket policy for the config's folder. Paste it as it is into a bucket with no policy; for a bucket that already has one, add its two statements to the existing `Statement` list. It covers `[<prefix>/]`, or the config's own folder when there is no prefix, and uses `YOUR_BUCKET_NAME` and `YOUR_CONFIG_NAME` for values not sent
- **`session_arn` (required)**: `string`

  Tenjin's session for your organization, the principal both statements name. Every write and every bucket permission check runs in it

**Example:**

```json
{
  "session_arn": "arn:aws:sts::038620613384:assumed-role/tenjin-cloud-data-exporter/cde-5f2b8c1e-0a4d-4e6f-9b3a-7c8d9e0f1a2b",
  "bucket_policy": {
    "Version": "2012-10-17",
    "Statement": [
      {
        "Sid": "TenjinCloudDataExporterV2",
        "Effect": "Allow",
        "Principal": {
          "AWS": "arn:aws:sts::038620613384:assumed-role/tenjin-cloud-data-exporter/cde-5f2b8c1e-0a4d-4e6f-9b3a-7c8d9e0f1a2b"
        },
        "Action": [
          "s3:GetObject",
          "s3:PutObject",
          "s3:DeleteObject",
          "s3:AbortMultipartUpload"
        ],
        "Resource": "arn:aws:s3:::acme-tenjin-exports/tenjin-exports/*"
      },
      {
        "Sid": "TenjinCloudDataExporterV2List",
        "Effect": "Allow",
        "Principal": {
          "AWS": "arn:aws:sts::038620613384:assumed-role/tenjin-cloud-data-exporter/cde-5f2b8c1e-0a4d-4e6f-9b3a-7c8d9e0f1a2b"
        },
        "Action": "s3:ListBucket",
        "Resource": "arn:aws:s3:::acme-tenjin-exports",
        "Condition": {
          "StringLike": {
            "s3:prefix": "tenjin-exports/*"
          }
        }
      }
    ]
  }
}
```

### 401, 403, 422

- `401` The access token was revoked, or your user role has no access to the Cloud Data Exporter
- `403` Missing or malformed access token, or the Cloud Data Exporter is not enabled for this organization
- `422` A bucket value that is not a bucket name, or a name or prefix the config endpoints refuse

**Content type:** `application/json`

schema: `Error`

- **`error` (required)**: `string`

  Error message (same as title, for backward compatibility)
- **`status` (required)**: `integer`

  HTTP status code
- **`title` (required)**: `string`

  Short, human-readable summary
- **`type` (required)**: `string`

  URI identifying the problem type
- **`detail`**: `string`

  Human-readable explanation specific to this occurrence

**Example:**

```json
{
  "error": "",
  "type": "",
  "title": "",
  "status": 422,
  "detail": ""
}
```

## Schemas

- `CloudDataExporterBucketPolicy` — shown above.
- `Error` — shown above.
