Tasks API is broken with launch token auth

Situation

I’m trying to call the api/v2/tasks endpoint. I’m using my runner launch token to make this call. The documentation says that this is supported.

Result

The request fails with the message: 'unauthorized'

My request looks like this:

fetch("https://runner.circleci.com/api/v2/tasks?resource-class=test-namespace/test-resource", {
  headers: { Authorization: "Bearer XXXXXXXXXXXXX" },
})

This request works fine if I use my personal token, like this:

fetch("https://runner.circleci.com/api/v2/tasks?resource-class=test-namespace/test-resource", {
  headers: { "Circle-Token": "XXXXXXXXXXXXX" },
})

…but I can’t do this for the project I’m working on.

For my launch token, I am using the token I generated in the process of setting up a self-hosted runner.

Please help!

Hey, sorry about that. This is an issue with our docs, launch token should not be on the list for the api/v2/tasks endpoint. Only the Circle token and browser session authentication are supported for that endpoint. I’m updating the docs right now to be accurate.

1 Like