Create a new event
curl --request POST \
--url https://api.example.com/public/events \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"name": "<string>",
"date": "2023-11-07T05:31:56Z",
"description": "<string>",
"category": "BUSINESS",
"metadata": {
"source": "gitlab",
"event": "Merged PR #123",
"owner": "John Doe",
"link": "https://gitlab.com/your_org/repo/merge_requests/123"
},
"labels": []
}
'import requests
url = "https://api.example.com/public/events"
payload = {
"name": "<string>",
"date": "2023-11-07T05:31:56Z",
"description": "<string>",
"category": "BUSINESS",
"metadata": {
"source": "gitlab",
"event": "Merged PR #123",
"owner": "John Doe",
"link": "https://gitlab.com/your_org/repo/merge_requests/123"
},
"labels": []
}
headers = {
"x-api-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
date: '2023-11-07T05:31:56Z',
description: '<string>',
category: 'BUSINESS',
metadata: {
source: 'gitlab',
event: 'Merged PR #123',
owner: 'John Doe',
link: 'https://gitlab.com/your_org/repo/merge_requests/123'
},
labels: []
})
};
fetch('https://api.example.com/public/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/public/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'date' => '2023-11-07T05:31:56Z',
'description' => '<string>',
'category' => 'BUSINESS',
'metadata' => [
'source' => 'gitlab',
'event' => 'Merged PR #123',
'owner' => 'John Doe',
'link' => 'https://gitlab.com/your_org/repo/merge_requests/123'
],
'labels' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/public/events"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"category\": \"BUSINESS\",\n \"metadata\": {\n \"source\": \"gitlab\",\n \"event\": \"Merged PR #123\",\n \"owner\": \"John Doe\",\n \"link\": \"https://gitlab.com/your_org/repo/merge_requests/123\"\n },\n \"labels\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/public/events")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"category\": \"BUSINESS\",\n \"metadata\": {\n \"source\": \"gitlab\",\n \"event\": \"Merged PR #123\",\n \"owner\": \"John Doe\",\n \"link\": \"https://gitlab.com/your_org/repo/merge_requests/123\"\n },\n \"labels\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/public/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"category\": \"BUSINESS\",\n \"metadata\": {\n \"source\": \"gitlab\",\n \"event\": \"Merged PR #123\",\n \"owner\": \"John Doe\",\n \"link\": \"https://gitlab.com/your_org/repo/merge_requests/123\"\n },\n \"labels\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}{
"error": "<string>",
"reason": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"summary": "<string>"
}{
"error": "<string>"
}Events
Create a new event
Endpoint to create a new event using public API.
POST
/
public
/
events
Create a new event
curl --request POST \
--url https://api.example.com/public/events \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"name": "<string>",
"date": "2023-11-07T05:31:56Z",
"description": "<string>",
"category": "BUSINESS",
"metadata": {
"source": "gitlab",
"event": "Merged PR #123",
"owner": "John Doe",
"link": "https://gitlab.com/your_org/repo/merge_requests/123"
},
"labels": []
}
'import requests
url = "https://api.example.com/public/events"
payload = {
"name": "<string>",
"date": "2023-11-07T05:31:56Z",
"description": "<string>",
"category": "BUSINESS",
"metadata": {
"source": "gitlab",
"event": "Merged PR #123",
"owner": "John Doe",
"link": "https://gitlab.com/your_org/repo/merge_requests/123"
},
"labels": []
}
headers = {
"x-api-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
date: '2023-11-07T05:31:56Z',
description: '<string>',
category: 'BUSINESS',
metadata: {
source: 'gitlab',
event: 'Merged PR #123',
owner: 'John Doe',
link: 'https://gitlab.com/your_org/repo/merge_requests/123'
},
labels: []
})
};
fetch('https://api.example.com/public/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/public/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'date' => '2023-11-07T05:31:56Z',
'description' => '<string>',
'category' => 'BUSINESS',
'metadata' => [
'source' => 'gitlab',
'event' => 'Merged PR #123',
'owner' => 'John Doe',
'link' => 'https://gitlab.com/your_org/repo/merge_requests/123'
],
'labels' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/public/events"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"category\": \"BUSINESS\",\n \"metadata\": {\n \"source\": \"gitlab\",\n \"event\": \"Merged PR #123\",\n \"owner\": \"John Doe\",\n \"link\": \"https://gitlab.com/your_org/repo/merge_requests/123\"\n },\n \"labels\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/public/events")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"category\": \"BUSINESS\",\n \"metadata\": {\n \"source\": \"gitlab\",\n \"event\": \"Merged PR #123\",\n \"owner\": \"John Doe\",\n \"link\": \"https://gitlab.com/your_org/repo/merge_requests/123\"\n },\n \"labels\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/public/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"category\": \"BUSINESS\",\n \"metadata\": {\n \"source\": \"gitlab\",\n \"event\": \"Merged PR #123\",\n \"owner\": \"John Doe\",\n \"link\": \"https://gitlab.com/your_org/repo/merge_requests/123\"\n },\n \"labels\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}{
"error": "<string>",
"reason": "<string>",
"details": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"summary": "<string>"
}{
"error": "<string>"
}Authorizations
API token for authentication (or Admin API key). The token is scoped per organization and can be retrieved in the Organization Switcher.
Body
application/json
Name of the event (minimum 5 characters)
Minimum string length:
5Date of the event (ISO 8601 format or parseable date string)
Detailed description of the event
Category of the event: BUSINESS, TECHNICAL, or PROVIDER (defaults to BUSINESS)
Available options:
BUSINESS, TECHNICAL, PROVIDER Additional metadata about the event (key-value pairs). Example: source, event, owner, link
Show child attributes
Show child attributes
Labels/tags for the event (maximum 5)
Maximum array length:
5Response
Event created successfully
The unique identifier of the created event
Last modified on August 10, 2026
Was this page helpful?
⌘I
