Does this help? It's not an official document but may help explain some steps.
Original Message:
Sent: Fri July 25, 2025 01:40 PM
From: Matt McNabb
Subject: Cognos Analytics API Authentication with API Key
Greg,
I had read through the v12 documentation and started there, but to no avail. Any PUT requests to the /api/v1/sessions endpoint returns a 401 unauthorized error from the server. I tried both with password auth and with API key auth as shown in that document. I should note that we have SSO set up with Cognos, and there are no native Cognos accounts on the system. Based on the docs I believe API key auth is the correct path for our scenario.
It's also worth mentioning that our Cognos software is provided as part of another software package through a software vendor. In other words, I didn't perform the installation and don't have a ton of insight into how it was configured. Is it possible that further configuration is required to make our API functional? If so, is there guidance on that? I am able to investigate our configuration, so at the least with that knowledge in hand I could work with our vendor to get the API set up.
The good news is that with a bit of study we were able to address our immediate needs without the use of the API, and further investigation into the API is now just for my own curiosity. I'd like to see what additional capabilities it will provide us in the future.
Thanks all!
------------------------------
Matt McNabb
Original Message:
Sent: Fri July 25, 2025 12:31 PM
From: GREG MCDONALD
Subject: Cognos Analytics API Authentication with API Key
Hi Matt,
I searched our 11.2.4 documentation and cannot find it but this is the Doc link. this should apply to 11.2.4. This was the first release that we exposed this feature so I feel that this is just a documentation issue.
https://www.ibm.com/docs/en/cognos-analytics/12.0.x?topic=api-getting-started-rest#c_ca_api_rest_getstarted__title__2
Greg
------------------------------
Greg McDonald
Product Manager - Cognos Analytics
IBM
greg.mcdonald@ca.ibm.com
https://www.linkedin.com/in/greg-mcdonald-6743961/
Original Message:
Sent: Fri July 25, 2025 12:24 PM
From: GREG MCDONALD
Subject: Cognos Analytics API Authentication with API Key
HI Matt,
I think this is what you are looking for:
{
"parameters": [
{
"name": "CAMAPILoginKey",
"value": "yourapikey"
}
]
}
------------------------------
Greg McDonald
Product Manager - Cognos Analytics
IBM
greg.mcdonald@ca.ibm.com
https://www.linkedin.com/in/greg-mcdonald-6743961/
Original Message:
Sent: Fri July 25, 2025 08:10 AM
From: Matt McNabb
Subject: Cognos Analytics API Authentication with API Key
Robert,
Thanks for the response! I just tried that and unfortunately it didn't work - I get a 404 on a GET request to the session endpoint. At this point I'm not sure the Cognos server is set up properly for the API.
I did find some other information on API authentication in v11 in the meantime. I found this documentation and it doesn't mention authenticating via an API Key
https://www.ibm.com/docs/en/cognos-analytics/11.2.x?topic=api-rest-sample
I am able to generate a key though, so I'm a little confused. I'll keep digging in case I can find something.
------------------------------
Matt McNabb
Original Message:
Sent: Wed July 23, 2025 10:12 AM
From: Robert Hofstetter
Subject: Cognos Analytics API Authentication with API Key
Matt,
I thought this change was new to v12 but I recently noticed a similar issue in 12.0.4 so perhaps it was a change introduced with a recent fix pack in 11.2.4 even. Anyway, what I found out is you cannot initiate the authentication anymore without first having an XSRF token. The way to get that is to first send a GET request to /api/v1/session without a payload and capture the cookie. Include that then on your PUT request to actually authenticate (and of course all subsequent requests). Try that and see if it works.
------------------------------
Robert Hofstetter
Original Message:
Sent: Tue July 22, 2025 12:01 AM
From: Matt McNabb
Subject: Cognos Analytics API Authentication with API Key
I'm attempting to use the REST Api with Cognos Analytics 11.2.4, and am having trouble authenticating. I've used the reference here:
https://www.ibm.com/docs/en/cognos-analytics/11.2.x?topic=api-rest-sample
but so far no dice. I'm creating a body like this:
{ "credentials": { "parameters": [ { "name": "CAMNamespace", "value": "<Namespace>" }, { "name": "CAMAPILoginKey", "value": "<API Key>" } ] }}
I continually get a 401 - Unauthorized error. Can anyone point me in the right direction for this?
If it helps, my goal is to use the REST API to automatically update a data module from an Excel sheet.
Thanks!
------------------------------
Matt McNabb
------------------------------