# Unable to update repo via API due to repo ownership

**URL:** <https://forum.gitea.com/t/unable-to-update-repo-via-api-due-to-repo-ownership/11858>\
**Category:** API/SDK/Tea/HelmChart/Terraform\
**Created:** [December 16, 2025, 4:06pm UTC](https://forum.gitea.com/t/unable-to-update-repo-via-api-due-to-repo-ownership/11858 "2025-12-16T16:06:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![reddeth](https://avatars.discourse-cdn.com/v4/letter/r/bbe5ce/32.png) [@reddeth](https://forum.gitea.com/u/reddeth)\
**Post date:** [December 16, 2025, 4:06pm UTC](https://forum.gitea.com/t/unable-to-update-repo-via-api-due-to-repo-ownership/11858/1 "2025-12-16T16:06:02Z")

</div>

Good day, friends!

### tl;dr:

When trying to update a repo via the API I receive an error back:

```auto
{"message":"user should be an owner or a collaborator with admin write of a repository","url":"https://gitea.mydomain.com/api/swagger"}

```

Even though the API token used is by a user who is in the “Owner” group on the organization/repo

### Deeper Context:

I have a Jenkins pipeline that, using the Gitea API and an access token tied to a user _called_ `jenkins`, creates a repository in an organization based on a template (the template also exists in the same organization). This operation happens just fine, the repo is created no problem.

Later in the pipeline (with the same `jenkins` user and API token) I want to go back and update some information on the repo based on other bits of data that have been collected from earlier pipeline steps. For example, I want to set the repo’s avatar

When I make the request, I receive this error in response:

```auto
{"message":"user should be an owner or a collaborator with admin write of a repository","url":"https://gitea.mydomain.com/api/swagger"}

```

But I’m a little confused why this happens, I believe my `jenkins` user _is_ an “owner”, for example here’s the organization (`services`) members:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/e/e38acb971fd1bf0f6d60f8a94678f4d279be0861.png)

`jenkins` is listed as an owner. In the `template` repo (that the other repos are created based off), it shows that the Owners team (which `jenkins` is a part of) is set to be a team. (I was hoping to upload a screenshot here to prove it out, but as a new user I can’t upload more than one media item - but when I navigate to the repository → settings → Collaborators it shows `Owners` as one of the `Teams`)

Similarly, if I look at a `test` repo I created, it also shows the same ownership permissions (again, can’t upload more than one media item, but same thing Repository → Settings → Collaborators shows `Owners` as one of the `Teams` on the repo)

So my `jenkins` user (I _think_) is a repo “owner”. Is there any other step I need to do to get the permissioning to be happy with the new repo and allow updates to it?

I’m on Gitea version 1.23.8 if it makes any difference

---

<div class="post-metadata">

**Author:** ![reddeth](https://avatars.discourse-cdn.com/v4/letter/r/bbe5ce/32.png) [@reddeth](https://forum.gitea.com/u/reddeth)\
**Post date:** [December 17, 2025, 2:13pm UTC](https://forum.gitea.com/t/unable-to-update-repo-via-api-due-to-repo-ownership/11858/2 "2025-12-17T14:13:56Z")

</div>

Okay wait scratch that question, I’m an idiot, turns out the entire issue was how I was passing in the Gitea token in the Jenkins pipeline. Not an issue with Gitea at all 🤦‍♂️ Apologies for the mistake on my end!
