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

# Create a storage credential

> Register a credential the workspace can use to read customer storage.

`POST /api/v1/storagecredentials`

Register a credential the workspace can use to read customer storage.

## Access

[Request a workspace OAuth token](https://docs.e6data.com/api-reference/workspace-oauth-2-0/post-oauth2-token.md#request) for the workspace that owns the resource. If your workspace uses OAuth scopes for API access, request `query_engine.storage_credentials:create`. If your admin confirms that workspace permissions are active for management API calls, omit the `scope` field for this call.

## Request

Body: name, cloudProvider and the matching configuration. The example uses an AWS role. Replace the role ARN with the role set up for this workspace.

Content type: `application/json`.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "name": "analytics-read",
  "cloudProvider": "AWS",
  "aws": {
    "authMode": "ASSUME_ROLE",
    "region": "us-east-1",
    "roleArn": "arn:aws:iam::123456789012:role/example-read"
  }
}
```

### Body fields

| Field | Type | Input | Details |
| - | - | - | - |
| `aws` | object | Optional | AWS-specific storage credentials |
| `aws.accessKeyId` | string | Optional | Access key ID (required for STATIC) |
| `aws.authMode` | string | Required when `aws` is supplied | Auth mode: ASSUME\_ROLE or STATIC Allowed values: `ASSUME_ROLE`, `STATIC`. |
| `aws.externalId` | string | Optional | External ID for legacy cross-account ASSUME\_ROLE |
| `aws.region` | string | Optional | Default AWS region |
| `aws.roleArn` | string | Optional | IAM role ARN (required for ASSUME\_ROLE) |
| `aws.secretAccessKey` | string | Optional | Secret component of a static AWS access key. Required with `STATIC` authentication. Keep the request out of logs. |
| `aws.sessionDuration` | string | Optional | Session duration for assumed role (e.g. "1h", "3600s") |
| `aws.sessionToken` | string | Optional | Session token (optional, for STATIC with temporary credentials) |
| `azure` | object | Optional | Azure-specific storage credentials |
| `azure.accountName` | string | Optional | - |
| `azure.clientId` | string | Required when `azure` is supplied | - |
| `azure.clientSecret` | string | Optional | - |
| `azure.tenantId` | string | Required when `azure` is supplied | Azure tenant ID for this connection. |
| `cloudProvider` | string | Required | Cloud provider (selects which subspec is consulted) Allowed values: `AWS`, `AZURE`, `GCP`. |
| `description` | string | Optional | Optional human-readable description |
| `gcp` | object | Optional | GCP-specific storage credentials |
| `gcp.keyJson` | string | Optional | - |
| `gcp.projectId` | string | Required when `gcp` is supplied | - |
| `gcp.serviceAccountEmail` | string | Required when `gcp` is supplied | - |
| `name` | string | Required | Resource name (DNS-compatible) Minimum length: 1. Maximum length: 253. |

### Example request

Save the JSON request above as `request.json`.
Set `WORKSPACE_URL` to the same HTTPS workspace origin and `ACCESS_TOKEN` to the access token from that workspace.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --proto '=https' --silent --show-error --fail-with-body \
  --request POST \
  --header @- \
  --header 'Content-Type: application/json' \
  --data-binary @request.json \
  "$WORKSPACE_URL/api/v1/storagecredentials" <<< "Authorization: Bearer $ACCESS_TOKEN"
```

## Response

HTTP `201`. Content type: `application/json`.

Example response (selected fields and sample values):

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "message": "<message from your workspace>",
  "name": "analytics-read"
}
```

The `message` field contains text from your workspace. The example uses a placeholder for that text.

Availability depends on your workspace release and enabled features. Keep sensitive inputs in your secret manager. Do not add real keys to a guide or support ticket.

## Troubleshooting

For `401`, check the workspace URL and token expiry. For `403`, ask your admin to check the machine client’s access to this operation and resource. In a scope-based workspace, also check the scope on the token. [Troubleshoot the token or request](https://docs.e6data.com/api-reference/list-clusters-with-oauth.md#troubleshoot-a-request).

## Related guides

[Workspace management guide](https://docs.e6data.com/platform/automate/authentication.md)


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