Bootstrap FreeKB - SendGrid - List API Keys using the REST API
SendGrid - List API Keys using the REST API

Updated:   |  SendGrid articles

Here is an example of how you can list the API Keys that belong to the user.

curl --header "Authorization: Bearer SA.14Hj6fh1RBSXoatMt4f5hg.zOhdOFKuitjqOtWatZXmGefxDMFDWIIElNhe7vb78z9" --request GET --url https://api.sendgrid.com/v3/api_keys

 

Something like this should be returned.

{
    "result": [
        {
            "name": "default API Key for smtp.sendgrid.net relay",
            "api_key_id": "xyz123456789xyz1234567"
        },
        {
            "name": "default",
            "api_key_id": "abcdefg123456789abcdef"
        }
    ]
}

 

An api_key_id can be include in the GET request to return the scopes for the API Key.

curl --header "Authorization: Bearer SA.14Hj6fh1RBSXoatMt4f5hg.zOhdOFKuitjqOtWatZXmGefxDMFDWIIElNhe7vb78z9" --request GET --url https://api.sendgrid.com/v3/api_keys/5dKz6fh1RBSXVk34twvI23

 

Something like this should be returned.

{
    "api_key_id": "5dKz6fh1RBSXVk34twvI23",
    "name": "default",
    "scopes": [
        "alerts.create",
        "alerts.read",
        "alerts.update",
        "alerts.delete",
        "asm.groups.create",
        "asm.groups.read",
        "asm.groups.update",
        "asm.groups.delete",
        "asm.groups.suppressions.create",
        "asm.groups.suppressions.read",
        "asm.groups.suppressions.update",
        "asm.groups.suppressions.delete"
  ]
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter f6789e in the box below so that we can be sure you are a human.