Skip to content

Quick Start

This guide will help you make your first API request to Cohost.

Before you begin, you’ll need:

  1. A Cohost account at cohost.vip
  2. An API key generated from your Cohost dashboard

The Cohost API is a RESTful API that accepts JSON requests and returns JSON responses. Let’s make your first request to list coupons:

Terminal window
curl https://api.cohost.vip/v1/coupons \
-H "Authorization: Bearer your_api_key_here"
const response = await fetch('https://api.cohost.vip/v1/coupons', {
headers: {
'Authorization': 'Bearer your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
response = requests.get(
'https://api.cohost.vip/v1/coupons',
headers={
'Authorization': 'Bearer your_api_key_here'
}
)
data = response.json()
print(data)

You’ll receive a JSON response:

{
"status": "ok",
"data": [
{
"id": "coupon_123",
"code": "SUMMER2024",
"discountType": "percentage",
"discountValue": 20
}
]
}