This API provides a Sanity-like interface for working with your content. It allows you to query content, create and update documents, and work with schemas in a flexible way.
The base URL for all API requests is:
https://aiseotrack.com/api/v1
All API requests require authentication using a bearer token.
Add the following header to your requests:
Authorization: Bearer YOUR_API_TOKEN
You can generate an API token in your account settings.
AiSEOTrack offers different subscription plans to meet your needs:
Feature | Free | Basic | Pro | Enterprise |
---|---|---|---|---|
API Request Limit | 100/day | 1,000/day | 10,000/day | Unlimited |
Read Access | ✓ | ✓ | ✓ | ✓ |
Write Access | ✗ | ✓ | ✓ | ✓ |
Content Items | 10 | 50 | Unlimited | Unlimited |
Different endpoints are available based on your subscription plan:
Endpoint | Method | Required Plan |
---|---|---|
/v1/query | GET | Public (No Auth) |
/v1/schemas | GET | Public (No Auth) |
/v1/schema/{name} | GET | Public (No Auth) |
/v1/documents | GET | Free or higher |
/v1/document/{id} | GET | Free or higher |
/v1/documents | POST | Basic or higher |
/v1/document/{id} | PUT | Basic or higher |
/v1/document/{id} | DELETE | Basic or higher |
Returns all available schemas.
// Response
[
{
"name": "article",
"definition": {
"title": "Article",
"description": "A blog article",
"fields": [...]
}
},
...
]
Returns a specific schema by name.
// Response
{
"name": "article",
"definition": {
"title": "Article",
"description": "A blog article",
"fields": [
{
"name": "title",
"type": "string",
"required": true,
"description": "The article title"
},
...
]
}
}
Returns all documents of a specific schema type.
// Response
[
{
"_id": 1,
"_type": "article",
"title": "My first article",
"content": "This is the content...",
...
},
...
]
Returns a specific document by ID.
// Response
{
"_id": 1,
"_type": "article",
"title": "My first article",
"content": "This is the content...",
...
}
Creates a new document.
// Request
{
"_type": "article",
"title": "My new article",
"content": "This is the content...",
...
}
// Response
{
"_id": 2,
"_type": "article",
"title": "My new article",
"content": "This is the content...",
...
}
Updates an existing document.
// Request
{
"title": "Updated title",
"content": "Updated content...",
...
}
// Response
{
"_id": 2,
"_type": "article",
"title": "Updated title",
"content": "Updated content...",
...
}
Deletes a document.
// Response
{
"message": "Document deleted successfully"
}
The API provides a simplified GROQ-like query language for fetching documents.
Example queries:
// Get all articles
*[_type == "article"]
// Get all articles with specific fields
*[_type == "article"]{title, publishedAt}
// Get articles with a specific title (more complex queries coming soon)
*[_type == "article" && title == "My Article"]
We provide a JavaScript SDK to make it easy to integrate with your website or application. You can include the SDK directly from your AiSEOTrack installation:
<script src="https://aiseotrack.com/js/content-api.js"></script>
Or install via npm:
npm install seo-content-sdk
Initialize the client:
const client = new ContentClient({
projectUrl: 'https://aiseotrack.com',
apiVersion: 'v1',
// token: 'your-auth-token' // Optional, for authenticated requests
});
// Fetch all articles
client.fetch('*[_type == "article"]').then(articles => {
console.log('Articles:', articles);
});
// Fetch with specific fields
client.fetch('*[_type == "article"]{title, publishedAt}').then(articles => {
console.log('Articles:', articles);
});
const doc = {
_type: 'article',
title: 'My New Article',
content: 'This is the content...',
publishedAt: new Date().toISOString()
};
client.create(doc).then(result => {
console.log('Created article:', result);
});
const updates = {
title: 'Updated Title',
content: 'Updated content...'
};
client.update(documentId, updates).then(result => {
console.log('Updated article:', result);
});
client.deleteDocument(documentId).then(result => {
console.log('Deleted article:', result);
});
<!DOCTYPE html>
<html>
<head>
<title>My Blog</title>
<script src="https://aiseotrack.com/js/seo-content-sdk.js"></script>
</head>
<body>
<div id="articles"></div>
<script>
const contentClient = SeoContent.createClient({
projectId: 'https://aiseotrack.com',
dataset: 'production',
apiVersion: 'v1',
token: 'YOUR_API_TOKEN'
});
// Fetch all articles and render them
contentClient.fetch('*[_type == "article"] | order(publishedAt desc)').then(articles => {
const container = document.getElementById('articles');
articles.forEach(article => {
const articleDiv = document.createElement('div');
articleDiv.innerHTML = `
<h2>${article.title}</h2>
<div>${article.content}</div>
<p>Published: ${new Date(article.publishedAt).toLocaleDateString()}</p>
`;
container.appendChild(articleDiv);
});
});
</script>
</body>
</html>