curl -XPOST https://qstash.upstash.io/v2/topics/:topicName/endpoints \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"endpoints": [
{
"name": "endpoint1",
"url": "https://example.com"
},
{
"name": "endpoint2",
"url": "https://somewhere-else.com"
}
]
}'
const response = await fetch('https://qstash.upstash.io/v2/topics/:topicName/endpoints', {
method: 'POST',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'endpoints': [
{
'name': 'endpoint1',
'url': 'https://example.com'
},
{
'name': 'endpoint2',
'url': 'https://somewhere-else.com'
}
]
})
});
import requests
headers = {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
}
json_data = {
'endpoints': [
{
'name': 'endpoint1',
'url': 'https://example.com',
},
{
'name': 'endpoint2',
'url': 'https://somewhere-else.com',
},
],
}
response = requests.post(
'https://qstash.upstash.io/v2/topics/:topicName/endpoints',
headers=headers,
json=json_data
)
var data = strings.NewReader(`{
"endpoints": [
{
"name": "endpoint1",
"url": "https://example.com"
},
{
"name": "endpoint2",
"url": "https://somewhere-else.com"
}
]
}`)
req, err := http.NewRequest("POST", "https://qstash.upstash.io/v2/topics/:topicName/endpoints", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
Topics
Upsert Topic and Endpoint
Add an endpoint to a topic
POST
/
v2
/
topics
/
{topicName}
/
endpoints
curl -XPOST https://qstash.upstash.io/v2/topics/:topicName/endpoints \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"endpoints": [
{
"name": "endpoint1",
"url": "https://example.com"
},
{
"name": "endpoint2",
"url": "https://somewhere-else.com"
}
]
}'
const response = await fetch('https://qstash.upstash.io/v2/topics/:topicName/endpoints', {
method: 'POST',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'endpoints': [
{
'name': 'endpoint1',
'url': 'https://example.com'
},
{
'name': 'endpoint2',
'url': 'https://somewhere-else.com'
}
]
})
});
import requests
headers = {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
}
json_data = {
'endpoints': [
{
'name': 'endpoint1',
'url': 'https://example.com',
},
{
'name': 'endpoint2',
'url': 'https://somewhere-else.com',
},
],
}
response = requests.post(
'https://qstash.upstash.io/v2/topics/:topicName/endpoints',
headers=headers,
json=json_data
)
var data = strings.NewReader(`{
"endpoints": [
{
"name": "endpoint1",
"url": "https://example.com"
},
{
"name": "endpoint2",
"url": "https://somewhere-else.com"
}
]
}`)
req, err := http.NewRequest("POST", "https://qstash.upstash.io/v2/topics/:topicName/endpoints", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
If the topic does not exist, it will be created. If the endpoint does not exist, it will be created.
Request
string
required
The name of your topic. If it doesn’t exist yet, it will be created.
Array
required
Response
This endpoint returns 200 if the endpoints are added successfully.curl -XPOST https://qstash.upstash.io/v2/topics/:topicName/endpoints \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"endpoints": [
{
"name": "endpoint1",
"url": "https://example.com"
},
{
"name": "endpoint2",
"url": "https://somewhere-else.com"
}
]
}'
const response = await fetch('https://qstash.upstash.io/v2/topics/:topicName/endpoints', {
method: 'POST',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'endpoints': [
{
'name': 'endpoint1',
'url': 'https://example.com'
},
{
'name': 'endpoint2',
'url': 'https://somewhere-else.com'
}
]
})
});
import requests
headers = {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
}
json_data = {
'endpoints': [
{
'name': 'endpoint1',
'url': 'https://example.com',
},
{
'name': 'endpoint2',
'url': 'https://somewhere-else.com',
},
],
}
response = requests.post(
'https://qstash.upstash.io/v2/topics/:topicName/endpoints',
headers=headers,
json=json_data
)
var data = strings.NewReader(`{
"endpoints": [
{
"name": "endpoint1",
"url": "https://example.com"
},
{
"name": "endpoint2",
"url": "https://somewhere-else.com"
}
]
}`)
req, err := http.NewRequest("POST", "https://qstash.upstash.io/v2/topics/:topicName/endpoints", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
Was this page helpful?
⌘I