Skip to main content
POST
/
repos
/
{owner}
/
{repo}
/
hooks
Create a hook
curl --request POST \
  --url https://gogs.example.com/api/v1/repos/{owner}/{repo}/hooks \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "gogs",
  "config": {
    "url": "<string>",
    "content_type": "json",
    "secret": "<string>"
  },
  "events": [
    "push"
  ],
  "active": false
}
'
{
  "id": 123,
  "type": "gogs",
  "events": [
    "<string>"
  ],
  "active": true,
  "config": {},
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Personal access token. Use format: token {YOUR_ACCESS_TOKEN}

Path Parameters

owner
string
required

Repository owner

repo
string
required

Repository name

Body

application/json
type
enum<string>
required
Available options:
gogs,
slack,
discord,
dingtalk
config
object
required
events
string[]
active
boolean
default:false

Response

Created

id
integer
type
enum<string>
Available options:
gogs,
slack,
discord,
dingtalk
events
string[]
active
boolean
config
object
created_at
string<date-time>
updated_at
string<date-time>