# GenerateIamPolicy Method

## Description

Generates an Amazon IAM policy document for an Amazon credential.

## HTTP Request

`GET https://api.skeddly.com/api/Credentials/<id>/IamPolicy`

## URL Parameters

### id

ID of the credential.

Type: `string`

Required: Yes

## Query Parameters

### extras

Comma-separated list of extra data to include.

Type: `string`

Valid Values:

* `my-resources`

Required: No

## Returns

A JSON string containing an IAM policy document.

The IAM policy document is in JSON format, but it is encased in a JSON string.

Deserialize the response body as a JSON string. Then, if required, deserialize the string contents as an Amazon IAM policy document.

## Sample Request

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

```http
GET /api/Credentials/cred-00000001/IamPolicy HTTP/1.1
Host: api.skeddly.com
Authorization: AccessKey <api key>
```

{% endtab %}

{% tab title="Bash" %}

```bash
curl "https://api.skeddly.com/api/Credentials/cred-00000001/IamPolicy" \
  -H "Authorization: AccessKey <api key>"
```

{% endtab %}
{% endtabs %}

## Sample Response

```javascript
"{
    \"Version\": \"2012-10-17\",
    \"Statement\": [
        {
            \"Effect\": \"Allow\",
            \"Action\": [
                \"ec2:DescribeInstances\",
                \"ec2:StartInstances\"
            ],
            \"Resource\": \"*\"
        }
    ]
}"
```


---

# 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/generateiampolicy-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.
