CircleCI API v2 Returns "404 Not Found"

Error Overview

When sending requests to CircleCI API v2 endpoints, you might receive a 404 response. Depending on which endpoint you're using at the time you could get any of the following response:

  • {"message" : "Not Found"}
  • {"message" : "Pipeline not found"}
  • {"message" : "Project not found"}
  • {"message" : "Workflow not found"}

 

Incorrect path

The response {"message" : "Not Found"} indicates that the URL path you specified is incorrect, specifically the endpoint path.

In case you receive this response, make sure that there are no typos in the endpoint path. (ex: "https://circleci.com/api/v2/wokflow" instead of "https://circleci.com/api/v2/workflow")

 

Invalid API token

Make sure the API token you're using is valid. You can check by sending an authenticated request to the "User Information" endpoint.

If your API token is stored in an environment variable that you referenced in your API request, make sure that environment variable is properly populated/interpolated. [Beware of the use of single quotes vs. double quotes]

 

Use of a project API token instead of a personal API token

Depending on the endpoint, the responses {"message" : "Project not found"}{"message" : "Pipeline not found"} or {"message" : "Workflow not found"} can happen when you're authenticating your API call using a project API token as opposed to a personal API token.

note: Please ensure that the user who created the personal API token has access to the repository.

Project tokens are currently not supported on API v2. Any token found under "Project Settings > API Permissions" is a project API token, regardless of the scope you assigned to it.

For any request made via CircleCI API v2 endpoints, make sure to use personal API tokens.

In case the API token is likely to be shared across your team, we recommend creating a machine-user and generating and personal API token for that machine-user.

 

Incorrect project name, pipeline ID or workflow ID

You API request will also returns a {"message" : "Project not found"}{"message" : "Pipeline not found"} or {"message" : "Workflow not found"} response if the project name, pipeline ID or workflow ID specified in the endpoint path is invalid (incorrect or truncated).

If you're using an environment variable to specify the project name, pipeline ID or workflow ID in your API call, make sure the related environment variable is properly populated.

 

 

Was this article helpful?
19 out of 64 found this helpful

Comments

0 comments

Article is closed for comments.