AppEngine API Reference

API endpoints available through AppEngine Service

Appmint Team9/14/2025

AppEngine API Reference

AppEngine (appengine.appmint.io) provides the backend API services for Appmint applications. This reference covers the available endpoints and how to use them.

Base Configuration

All API requests go through the Next.js proxy route at /api/[...slug] which forwards to AppEngine.

Never call AppEngine directly from the client. Always use the proxy pattern.

Authentication

AppEngine supports two authentication methods:

1. App Credentials (Recommended)

// Configured in .env.local
APP_ID=your_app_id
APP_KEY=your_app_key
APP_SECRET=your_app_secret

// The AppEngineClient automatically handles token generation

2. API Key

// Configured in .env.local
APPENGINE_API_KEY=your_api_key

// Included as x-api-key header

Core Repository Endpoints

Get Data by ID

GET /api/repository/get/{datatype}/{id}

Create Data

POST /api/repository/create/{datatype}
Content-Type: application/json

Body: {
  // Your data object
}

Update Data

POST /api/repository/update/{datatype}
Content-Type: application/json

Body: {
  sk: "record_id",
  // Updated fields
}

Delete Data

DELETE /api/repository/delete/{datatype}/{id}

Find Data

POST /api/repository/find/{datatype}
Content-Type: application/json

Body: {
  query: { /* MongoDB-style query */ },
  options: { limit: 10, skip: 0 }
}

Search Data

GET /api/repository/search/{datatype}?keyword={keyword}

Profile & Authentication

Get App Token

POST /api/profile/app/key
Content-Type: application/json

Body: {
  appId: "your_app_id",
  key: "your_app_key",
  secret: "your_app_secret"
}

User Sign In

POST /api/profile/customer/signin
Content-Type: application/json

Body: {
  email: "user@example.com",
  password: "password"
}

User Sign Up

POST /api/profile/customer/signup
Content-Type: application/json

Body: {
  email: "user@example.com",
  password: "password",
  name: "User Name"
}

Get User Profile

GET /api/profile/customer/profile
Authorization: Bearer {user_token}

CRM Endpoints

Leads Management

GET /api/crm/leads
POST /api/crm/leads
PUT /api/crm/leads/{id}
DELETE /api/crm/leads/{id}

Support Tickets

GET /api/crm/tickets/get
POST /api/crm/tickets/create
POST /api/crm/tickets/update
DELETE /api/crm/tickets/delete

Contact Forms

POST /api/crm/contact-form/json
Content-Type: application/json

Body: {
  name: "Contact Name",
  email: "contact@example.com",
  message: "Message content"
}

Events

GET /api/crm/events/get
POST /api/crm/events/create
POST /api/crm/events/update
DELETE /api/crm/events/delete

File Management

Upload File

POST /api/repository/file/upload
Content-Type: multipart/form-data

Body: FormData with file

Delete File

POST /api/repository/file/delete
Content-Type: application/json

Body: {
  path: "file/path"
}

Get File

POST /api/repository/file
Content-Type: application/json

Body: {
  path: "file/path"
}

AI Services

Generate Content

POST /api/ai/generate
Content-Type: application/json

Body: {
  prompt: "Your prompt",
  model: "gpt-4",
  parameters: {}
}

AI Agent Processing

POST /api/ai/agent/process
Content-Type: application/json

Body: {
  agentId: "agent_id",
  input: "User input",
  context: {}
}

Storefront/E-commerce

Products

GET /api/storefront/products
GET /api/storefront/product/{id}
POST /api/storefront/search

Orders

GET /api/storefront/orders/get
GET /api/storefront/order/get/{id}
POST /api/storefront/checkout-cart

Payment

GET /api/storefront/payment-gateways
POST /api/storefront/stripe/intent
POST /api/storefront/verify-payment

Site Management

Get Site

GET /api/site/get-site/{siteName}/{hostName}

Get Page

GET /api/site/page/{hostName}/{siteName}/{pagePath}

Usage Examples

JavaScript/TypeScript

// Using fetch API through the proxy
async function getUser(userId) {
  const response = await fetch(`/api/repository/get/users/${userId}`);
  return response.json();
}

// Creating a record
async function createLead(leadData) {
  const response = await fetch('/api/crm/leads', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(leadData)
  });
  return response.json();
}

// Using the AppEngineClient (server-side)
import { getAppEngineClient } from '@/lib/appmint-client';

const client = getAppEngineClient();
const result = await client.processRequest('GET', 'repository/get/users/123');

Response Format

Successful responses return the requested data directly:

{
  "id": "123",
  "name": "Example",
  "created_at": "2025-09-14T10:00:00Z"
}

Error responses include error details:

{
  "error": "Error message",
  "status": 400
}

Rate Limiting

AppEngine implements rate limiting. Check response headers:

  • Token renewal is automatic for 401 responses
  • Implement exponential backoff for 429 responses

Important Notes

  1. Always use the proxy: Never call appengine.appmint.io directly from client
  2. Token management: The AppEngineClient handles token renewal automatically
  3. Error handling: Implement proper error handling for network and API errors
  4. Environment variables: Keep all credentials in environment variables

For the complete list of endpoints, refer to src/lib/appmint-endpoints.ts in your project.