Create Campaign
curl --request POST \
--url https://jmpy.me/api/v1/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>"
}
'{
"success": true,
"data": {
"id": "<string>",
"name": "<string>",
"description": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"tags": [
{}
],
"url_count": 123,
"total_clicks": 123,
"created_at": "<string>"
}
}Campaigns
Create Campaign
Create a new campaign
POST
/
campaigns
Create Campaign
curl --request POST \
--url https://jmpy.me/api/v1/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>"
}
'{
"success": true,
"data": {
"id": "<string>",
"name": "<string>",
"description": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"tags": [
{}
],
"url_count": 123,
"total_clicks": 123,
"created_at": "<string>"
}
}Create a new campaign to organize and track your short URLs. Campaigns allow you to group URLs together and analyze their collective performance over time.
Body Parameters
The name of the campaign.Requirements:
- 1-100 characters
- Must be unique within your account
Summer Sale 2024A descriptive text about the campaign goals or details.Example:
Promotional links for the summer season discount eventResponse
Indicates if the request was successful.
The created campaign object.
Show Campaign Object
Show Campaign Object
Unique identifier for the campaign.
The campaign name.
The campaign description.
Start date of the campaign.
End date of the campaign.
Associated tags.
Number of short URLs associated with this campaign (starts at 0).
Total aggregated clicks for all URLs in this campaign.
Creation timestamp.
Request Examples
- cURL
- Node.js
- TypeScript
- Python
- PHP
- Go
- Java
curl -X POST "https://jmpy.me/api/v1/campaigns" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Summer Sale 2024",
"description": "Promotional links for the summer season discount event",
"start_date": "2024-06-01T00:00:00Z",
"end_date": "2024-08-31T23:59:59Z",
"tags": ["marketing", "summer"]
}'
const fetch = require('node-fetch');
const response = await fetch('https://jmpy.me/api/v1/campaigns', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Summer Sale 2024',
description: 'Promotional links for the summer season discount event',
start_date: '2024-06-01T00:00:00Z',
end_date: '2024-08-31T23:59:59Z',
tags: ['marketing', 'summer']
})
});
const data = await response.json();
import axios from 'axios';
const response = await axios.post(
'https://jmpy.me/api/v1/campaigns',
{
name: 'Summer Sale 2024',
description: 'Promotional links for the summer season discount event',
start_date: '2024-06-01T00:00:00Z',
end_date: '2024-08-31T23:59:59Z',
tags: ['marketing', 'summer']
},
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
}
);
import requests
url = "https://jmpy.me/api/v1/campaigns"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"name": "Summer Sale 2024",
"description": "Promotional links for the summer season discount event",
"start_date": "2024-06-01T00:00:00Z",
"end_date": "2024-08-31T23:59:59Z",
"tags": ["marketing", "summer"]
}
response = requests.post(url, headers=headers, json=payload)
<?php
$client = new GuzzleHttp\Client();
$response = $client->request('POST', 'https://jmpy.me/api/v1/campaigns', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_KEY',
'Content-Type' => 'application/json'
],
'json' => [
'name' => 'Summer Sale 2024',
'description' => 'Promotional links for the summer season discount event',
'start_date' => '2024-06-01T00:00:00Z',
'end_date' => '2024-08-31T23:59:59Z',
'tags' => ['marketing', 'summer']
]
]);
?>
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"name": "Summer Sale 2024",
"description": "Promotional links for the summer season discount event",
"start_date": "2024-06-01T00:00:00Z",
"end_date": "2024-08-31T23:59:59Z",
"tags": []string{"marketing", "summer"},
}
jsonValue, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://jmpy.me/api/v1/campaigns", bytes.NewBuffer(jsonValue))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
http.DefaultClient.Do(req)
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.URI;
import java.net.http.HttpResponse;
String json = """
{
"name": "Summer Sale 2024",
"description": "Promotional links for the summer season discount event",
"start_date": "2024-06-01T00:00:00Z",
"end_date": "2024-08-31T23:59:59Z",
"tags": ["marketing", "summer"]
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://jmpy.me/api/v1/campaigns"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
client.send(request, HttpResponse.BodyHandlers.ofString());
Response Examples
- 201 Created
- 400 Bad Request
- 401 Unauthorized
- 429 Rate Limited
{
"success": true,
"data": {
"id": "110e8400-e29b-41d4-a716-446655440000",
"name": "Summer Sale 2024",
"description": "Promotional links for the summer season discount event",
"start_date": "2024-06-01T00:00:00.000Z",
"end_date": "2024-08-31T23:59:59.000Z",
"tags": ["marketing", "summer"],
"url_count": 0,
"total_clicks": 0,
"created_at": "2024-01-15T10:30:00.000Z"
}
}
{
"success": false,
"error": {
"code": "BAD_REQUEST",
"message": "Invalid input parameters",
"details": "Property 'name' is required"
}
}
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}
}
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests, please try again later"
}
}
Related Endpoints
List Campaigns
View detailed information about a specific campaign
Create Short URL
Create a new short URL and assign it to a campaign
⌘I