Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Key format is not valid

Demirchyan_ Oganes
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 23, 2025


when posting via the code using generated header and payload I am getting following error




{"message":"Key format is not valid!","took":0.0,"requestId":"dd21ff02-99d8-4a6e-8712-496c50f3d3b3"}




Per internet resources resources you are supposed to use OPSGenie integration API key, which I am using. It's the Autosys one. When I use the same payload and headers in the Postman, it creates with no issues. Is it possible to find out what the issue could be?




This is the payload and header that code generates




payload

{"priority": "P3", "source": "autosys_monitoring", "message": "AUTOSYS ASI JOB Fail: dro_d_IOVP_chk_alert_resumable", "description": "dro_d_IOVP_chk_alert_resumable Failed on dfwrspdb", "responders": [{"type": "team", "id": "xxxxxx-54ef-4932-xxx-d62ca51dd4d4"}]}




Headers
{'Content-Type': 'application/json', 'Authorization': 'GenieKey xxxxxxx-xxxx-xxxxx-xxxx-xxxxx'}




Url to execute POST
https://api.opsgenie.com/v2/alerts

1 answer

0 votes
Egor
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 25, 2025

Hi There,

Thanks for sharing the details! Since your request works in Postman but fails in code with the "Key format is not valid!" error, it likely comes down to a formatting issue in how your script is sending the request.

A few things to check:

  • Make sure there are no extra spaces in the Authorization header (GenieKey YOUR_API_KEY).

  • Ensure the payload is properly serialized, for example using json.dumps() in Python.

  • Confirm the Content-Type header is correctly set to application/json.

  • Double-check that you're using the POST method to https://api.opsgenie.com/v2/alerts.

 

If this doesn't solve it, feel free to post a small snippet of your code (excluding the API key), and we can take a closer look.

Best Regards,
Egor

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events