# New v2 API Endpoint: job approval

**URL:** <https://discuss.circleci.com/t/new-v2-api-endpoint-job-approval/35834>\
**Category:** API\
**Created:** [May 7, 2020, 1:01pm UTC](https://discuss.circleci.com/t/new-v2-api-endpoint-job-approval/35834 "2020-05-07T13:01:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnswanson](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/johnswanson/32/18792_2.png) [@johnswanson](https://discuss.circleci.com/u/johnswanson)\
**Post date:** [May 7, 2020, 1:01pm UTC](https://discuss.circleci.com/t/new-v2-api-endpoint-job-approval/35834/1 "2020-05-07T13:01:22Z")

</div>

We have a new API endpoint available to allow you to approve jobs programatically. The endpoint is:

```auto
POST /api/v2/workflow/:id/approve/:approval-request-id

```

You can find the `approval_request_id` of the job you wish to approve via the `listWorkflowJobs` endpoint:

```auto
GET /api/v2/workflow/:id/job

```

Jobs that can be approved (i.e. approval jobs) will have an `approval_request_id` field.

See the [v2 API docs](https://circleci.com/docs/api/v2/#approve-a-job) for more details. Happy approving!

---

<div class="post-metadata">

**Author:** ![monfresh](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/monfresh/32/18045_2.png) [@monfresh](https://discuss.circleci.com/u/monfresh)\
**Post date:** [May 11, 2020, 6:21pm UTC](https://discuss.circleci.com/t/new-v2-api-endpoint-job-approval/35834/2 "2020-05-11T18:21:36Z")

</div>

Thanks for creating this endpoint. It’s very useful. I’m not able to use it successfully, though. I get a 404 when I try to make a POST request. I triple checked that I have the right workflow and approval request IDs. I also confirmed I have a working personal token because I’m able to make other GET requests. Any idea why this one might be returning a 404?

---

<div class="post-metadata">

**Author:** ![monfresh](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/monfresh/32/18045_2.png) [@monfresh](https://discuss.circleci.com/u/monfresh)\
**Post date:** [May 11, 2020, 9:28pm UTC](https://discuss.circleci.com/t/new-v2-api-endpoint-job-approval/35834/3 "2020-05-11T21:28:21Z")

</div>

I know what I did wrong. I’ve been using `RestClient` in Ruby, and for `GET` requests, I’ve been passing in the token via the params, as in `RestClient.get some_endpoint, params: { "circle-token" => my_token }`, but that doesn’t work for `post` requests. The token needs to be appended to the endpoint, as in `https://circleci.com/api/v2/workflow/{workflow_id}/approve/{approval_request_id}?circle-token=my_token`. If I try that with the job that I was trying to approve earlier (and that I ended up approving manually), then I get a 400 error saying the job was already approved, which is expected.

---

<div class="post-metadata">

**Author:** ![roopakv](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/roopakv/32/17711_2.png) [@roopakv](https://discuss.circleci.com/u/roopakv)\
**Post date:** [May 14, 2020, 5:28am UTC](https://discuss.circleci.com/t/new-v2-api-endpoint-job-approval/35834/4 "2020-05-14T05:28:35Z")

</div>

@johnswanson This is really cool! have been waiting a while for this 🙂

Any chance you can expose attributions via admins? I want to build an app that allows approvals from slack, and instead of me asking all my team for their circle tokens, i’ll use the token of a bot which is an admin and pass in sonething like `on_behalf_of` which thwn marks the job approves by that user.

I realize this is probably a huge ask, but curious if this can be planned
