OpsGenie API (Create alert) Authentication problem

premsaisala June 21, 2023

sh-3.2# curl --location --request POST 'https://api.opsgenie.com/v2/alerts' \--header 'Authorization: GenieKey 749797a2-8748-484b-8fc5-f48f006bc3f0' \--header 'Content-Type: application/json' \--data-raw ''\''{"message": "Test alert", "description": "This is just a test" }'\'''

{"code":40301,"message":"To perform this action, use an API key from an API integration.","took":0.001,"requestId":"66f7bfee-7f3c-4c65-8bb2-0e95c0c16bd0"}

1 answer

0 votes
Wei Wung
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 22, 2023

Hi @premsaisala 

Thank you for reaching out!  The error message suggests that you may be using an apiKey from Settings > API key management.  The apiKey from API key management cannot be used to create an alert.

If there isn't an API integration already created, you would need to add one and use its apiKey to create the alert.  If on an Essentials plan, you would create the API integration via Teams > click on a Team > then go to the Integration tab to Add the API integration.

Hope that helps.

Best Regards,

Wei

P/S:  suggest removing your apiKey from your curl statement and also from API key management as well since it is "exposed". ;-)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events