Login
Home

API Test Environment

Test ticket generation with a public API key. Tickets created here won't generate emails or notifications.

Test API Key

Use this API key to create test tickets. This key is publicly available and can be used by anyone for testing purposes.

qt_LusXv94IHuru81PrvcJ6GunPJZSX2bYbV2U4E-25cPI
Rotates in:

Example curl command:

# Step 1: Fetch categories
curl -X GET "https://bluetickets.app/api/categories?locale=en" \
  -H "Authorization: Bearer qt_LusXv94IHuru81PrvcJ6GunPJZSX2bYbV2U4E-25cPI" \
  -H "Accept-Language: en"

# Step 2: Create ticket with category (replace CATEGORY_ID with actual ID or omit for default)
curl -X POST https://bluetickets.app/api/tickets \
  -H "Authorization: Bearer qt_LusXv94IHuru81PrvcJ6GunPJZSX2bYbV2U4E-25cPI" \
  -H "Content-Type: application/json" \
  -d '{"title": "Test Ticket", "body": "This is a test", "requesterEmail": "[email protected]", "categoryId": "CATEGORY_ID"}'

Language Examples

Prefer SDK-style code? Expand any section below to copy a ready-to-run example.

Node.js example((requires node-fetch))

Run npm install node-fetch@3 and execute with Node.js 18+.

import fetch from "node-fetch";

async function createTicket() {
	const response = await fetch("https://bluetickets.app/api/tickets", {
		method: "POST",
		headers: {
			"Authorization": "Bearer qt_LusXv94IHuru81PrvcJ6GunPJZSX2bYbV2U4E-25cPI",
			"Content-Type": "application/json"
		},
		body: JSON.stringify({
			title: "SDK ticket",
			body: "Created via Node.js example",
			requesterEmail: "[email protected]"
		})
	});

	if (!response.ok) {
		throw new Error(`Request failed: ${response.status} ${response.statusText}`);
	}

	console.log(await response.json());
}

createTicket().catch(console.error);
Python example((requires requests))

Run pip install requests and execute with Python 3.10+.

import requests

API_KEY = "qt_LusXv94IHuru81PrvcJ6GunPJZSX2bYbV2U4E-25cPI"
BASE_URL = "https://bluetickets.app"

# Step 1: Fetch available categories
def fetch_categories(locale="en"):
    url = f"{BASE_URL}/api/categories?locale={locale}"
    headers = {
        "Authorization": f"Bearer {API_KEY}",
        "Accept-Language": locale
    }
    response = requests.get(url, headers=headers)
    response.raise_for_status()
    data = response.json()
    return data["categories"]

# Step 2: Create ticket with optional category
def create_ticket(category_id=None):
    url = f"{BASE_URL}/api/tickets"
    payload = {
        "title": "SDK ticket",
        "body": "Created via Python example",
        "requesterEmail": "[email protected]"
    }
    if category_id:
        payload["categoryId"] = category_id
    
    headers = {
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json"
    }
    
    response = requests.post(url, json=payload, headers=headers)
    response.raise_for_status()
    print(response.json())

# Usage: Fetch categories, then create ticket
categories = fetch_categories()
print("Available categories:", categories)
# Use first category or None for default
selected_category_id = categories[0]["id"] if categories else None
create_ticket(selected_category_id)
Java example((Java 11+))

Uses built-in java.net.http package. Compile and run with Java 11+.

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.time.Duration;
import org.json.JSONObject;
import org.json.JSONArray;

public class CreateTicket {
    private static final String API_KEY = "qt_LusXv94IHuru81PrvcJ6GunPJZSX2bYbV2U4E-25cPI";
    private static final String BASE_URL = "https://bluetickets.app";

    // Step 1: Fetch available categories
    public static JSONArray fetchCategories(String locale) throws Exception {
        String url = BASE_URL + "/api/categories?locale=" + locale;
        HttpClient client = HttpClient.newBuilder()
            .connectTimeout(Duration.ofSeconds(10))
            .build();

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Authorization", "Bearer " + API_KEY)
            .header("Accept-Language", locale)
            .GET()
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        
        if (response.statusCode() == 200) {
            JSONObject json = new JSONObject(response.body());
            return json.getJSONArray("categories");
        } else {
            throw new RuntimeException("Request failed: " + response.statusCode());
        }
    }

    // Step 2: Create ticket with optional category
    public static void createTicket(String categoryId) throws Exception {
        String url = BASE_URL + "/api/tickets";
        
        JSONObject jsonBody = new JSONObject();
        jsonBody.put("title", "SDK ticket");
        jsonBody.put("body", "Created via Java example");
        jsonBody.put("requesterEmail", "[email protected]");
        if (categoryId != null) {
            jsonBody.put("categoryId", categoryId);
        }

        HttpClient client = HttpClient.newBuilder()
            .connectTimeout(Duration.ofSeconds(10))
            .build();

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Authorization", "Bearer " + API_KEY)
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonBody.toString()))
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        
        if (response.statusCode() >= 200 && response.statusCode() < 300) {
            System.out.println(response.body());
        } else {
            throw new RuntimeException("Request failed: " + response.statusCode() + " " + response.body());
        }
    }

    public static void main(String[] args) throws Exception {
        // Fetch categories
        JSONArray categories = fetchCategories("en");
        System.out.println("Available categories: " + categories);
        
        // Use first category or null for default
        String selectedCategoryId = categories.length() > 0 
            ? categories.getJSONObject(0).getString("id") 
            : null;
        
        // Create ticket
        createTicket(selectedCategoryId);
    }
}

Live Ticket Stream

Tickets created with the test API key will appear here in real-time.

Loading tickets...