# Gitea Rest API to create a new admin user

**URL:** <https://forum.gitea.com/t/gitea-rest-api-to-create-a-new-admin-user/2310>\
**Category:** API/SDK/Tea/HelmChart/Terraform\
**Created:** [July 7, 2020, 1:37pm UTC](https://forum.gitea.com/t/gitea-rest-api-to-create-a-new-admin-user/2310 "2020-07-07T13:37:56Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![buddyspencer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/buddyspencer/32/4770_2.png) [@buddyspencer](https://forum.gitea.com/u/buddyspencer)\
**Post date:** [July 9, 2020, 4:29pm UTC](https://forum.gitea.com/t/gitea-rest-api-to-create-a-new-admin-user/2310/5 "2020-07-09T16:29:07Z")

</div>

@BagaSiva

```
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "http://localhost:3000/user/sign_up"

	payload := strings.NewReader("user_name=blub&email=blub%40bla.bla&password=dsklfjaskjfKAKLJSAKDJ1827.&retype=dsklfjaskjfKAKLJSAKDJ1827.")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("cookie", "lang=en-US; i_like_gitea=8e2779a79e7d3e28; _csrf=uBwdvQ2EKSS69kVzPIGOPI1OmoU6MTU5NDMxMTk2NzA1ODIxMjgzNw")
	req.Header.Add("content-type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

```

or a simple curl

```
curl --request POST \
  --url http://localhost:3000/user/sign_up \
  --header 'content-type: application/x-www-form-urlencoded' \
  --cookie 'lang=en-US; i_like_gitea=8e2779a79e7d3e28; _csrf=uBwdvQ2EKSS69kVzPIGOPI1OmoU6MTU5NDMxMTk2NzA1ODIxMjgzNw' \
  --data user_name=blub \
  --data email=blub@bla.bla \
  --data password=dsklfjaskjfKAKLJSAKDJ1827. \
  --data retype=dsklfjaskjfKAKLJSAKDJ1827.

```

and as @techknowlogick said, the first user is always the admin.

---

_[View the full topic](https://forum.gitea.com/t/gitea-rest-api-to-create-a-new-admin-user/2310)._
