curl --request POST \
--url https://api.example.com/api/clients \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"domain": "<string>",
"contactName": "<string>",
"contactEmail": "<string>"
}
'{
"id": "<string>",
"name": "<string>",
"domain": "<string>",
"contactName": "<string>",
"contactEmail": "<string>",
"userId": "<string>",
"googleSearchConsoleConnected": true,
"googleAnalyticsConnected": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"error": "<string>",
"requiresVerification": true,
"upgradeRequired": true,
"currentCount": 123,
"limit": 123,
"details": [
{}
]
}Create a new client for your agency
curl --request POST \
--url https://api.example.com/api/clients \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"domain": "<string>",
"contactName": "<string>",
"contactEmail": "<string>"
}
'{
"id": "<string>",
"name": "<string>",
"domain": "<string>",
"contactName": "<string>",
"contactEmail": "<string>",
"userId": "<string>",
"googleSearchConsoleConnected": true,
"googleAnalyticsConnected": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"error": "<string>",
"requiresVerification": true,
"upgradeRequired": true,
"currentCount": 123,
"limit": 123,
"details": [
{}
]
}curl -X POST https://your-domain.com/api/clients \
-H "Content-Type: application/json" \
-H "Cookie: next-auth.session-token=..." \
-d '{
"name": "Acme Corporation",
"domain": "https://acme.com",
"contactName": "John Doe",
"contactEmail": "[email protected]"
}'
const response = await fetch('/api/clients', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Acme Corporation',
domain: 'https://acme.com',
contactName: 'John Doe',
contactEmail: '[email protected]'
})
});
const client = await response.json();
{
"id": "clx1a2b3c4d5e6f7g8h9i0j1k",
"name": "Acme Corporation",
"domain": "https://acme.com",
"contactName": "John Doe",
"contactEmail": "[email protected]",
"userId": "clx0a1b2c3d4e5f6g7h8i9j0k",
"googleSearchConsoleConnected": false,
"googleAnalyticsConnected": false,
"searchConsolePropertyUrl": null,
"googleAnalyticsPropertyId": null,
"lastReportGenerated": null,
"totalReportsGenerated": 0,
"createdAt": "2024-03-15T10:30:00.000Z",
"updatedAt": "2024-03-15T10:30:00.000Z"
}
{
"error": "Validation error",
"details": [
{
"code": "too_small",
"minimum": 2,
"type": "string",
"inclusive": true,
"exact": false,
"message": "Name must be at least 2 characters",
"path": ["name"]
}
]
}
{
"error": "Please verify your email before adding clients",
"requiresVerification": true,
"verificationRequired": true
}
{
"error": "You have reached your plan limit of 3 clients",
"currentCount": 3,
"limit": 3,
"upgradeRequired": true
}
{
"error": "Unauthorized"
}