# CreateCredential Method

## Description

Registers a cloud-provider credential to be used.

## HTTP Request

`POST https://api.skeddly.com/api/Credentials/`

## Body

The body is a JSON structure with the following properties.

### amazonIamAccessKey

Parameters for the Amazon IAM access key credential. Required when `credentialType` is `amazon-access-key`.

Type: [AmazonIamAccessKeyParameters](/data-types/amazoniamaccesskeyparameters-object.md) object.

Required: Conditional

### amazonIamRole

Parameters for the Amazon IAM role credential. Required when `credentialType` is `amazon-iam-role`.

Type: [AmazonIamRoleParameters](/data-types/amazoniamroleparameters-object.md) object.

Required: Conditional

### azureCredential

Parameters for the Azure credential. Required when `credentialType` is `azure-credential`.

Type: [AzureCredentialParameters](/data-types/azurecredentialparameters-object.md) object.

Required: Conditional

### cloudProviderSubTypeId

Cloud-provider sub-type ID.

Type: `string`

Valid Values:

* `amazon-standard`
* `amazon-govcloud-us`
* `amazon-china`
* `azure-global`
* `google-standard`

Required: Yes

### credentialType

Type of credential being registered.

Type: `string`

Required: Yes

Valid Values:

* `amazon-iam-role`
* `amazon-access-key`
* `azure-credential`
* `google-service-account-key`

### googleServiceAccountKey

Parameters for the Google Cloud Provider service account key credential. Required when `credentialType` is `google-service-account-key`.

Type: [GoogleServiceAccountKeyParameters](/data-types/googleserviceaccountkeyparameters-object.md) object.

Required: Conditional

### name

Friendly name for the credential.

Type: `string`

Required: Yes

### projectId

The ID of the project in which to create the credential.

Type: `string`

Required: Recommended for future compatability

Default Value: The account's default project.

## Returns

A [Credential](/data-types/credential-object.md) object.

## &#x20;Sample Request

{% tabs %}
{% tab title="HTTP" %}

```http
POST /api/Credentials HTTP/1.1
Host: api.skeddly.com
Authorization: AccessKey <api key>
Content-Type: application/json

{
    "amazonIamRole": {
        "externalId": "skeddly-12345678",
        "roleArn": "arn:aws:iam::123456789012:role/Skeddly"
    },
    "cloudProviderSubTypeId": "amazon-standard",
    "credentialType": "amazon-iam-role",
    
    "name": "My Credential"
}
```

{% endtab %}

{% tab title="Bash" %}

```bash
curl -X POST "https://api.skeddly.com/api/Credentials" \
  -H "Authorization: AccessKey <api key>" \
  -d amazonIamRole.externalId=skeddly-12345678 \
  -d amazonIamRole.roleArn="arn:aws:iam::123456789012:role/Skeddly" \
  -d cloudProviderSubTypeId=amazon-standard \
  -d credentialType=amazon-iam-role \
  -d name="My Credential"
```

{% endtab %}
{% endtabs %}

## Sample Response

```javascript
{
    "amazonIamRole": {
        "roleArn": "arn:aws:iam::123456789012:role/Skeddly",
        "externalId": "skeddly-12345678"
    },
    "cloudProviderSubTypeId": "amazon-standard",
    "createdDate": "2016-06-08T14:42:00Z",
    "credentialId": "cred-00000001",
    "credentialType": "amazon-iam-role",
    "isUsedForSnsNotifications": false,
    "lastModifiedDate": "2016-06-08T14:42:00Z",
    "lastModifiedBy": "u-00000001",
    "name": "My Credential",
    "status": "active"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.skeddly.com/resources/credentials/createcredential-method.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
