API Endpoints Reference
This reference covers all available API endpoints in the FG API platform.
Base URL
All API endpoints are available at:
https://your-api-domain.com/api/Authentication
Most endpoints require authentication. Include your access token in the Authorization header:
Authorization: Bearer YOUR_ACCESS_TOKENEndpoint Management
List All Endpoints
Get a list of all available endpoints.
Endpoint: GET /api/endpoints
Headers:
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/jsonResponse:
[
{
"id": "cmf1234567890",
"name": "contact-form",
"description": "Contact form submissions",
"active": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
{
"id": "cmf0987654321",
"name": "user-feedback",
"description": "User feedback and ratings",
"active": true,
"created_at": "2024-01-14T09:15:00Z",
"updated_at": "2024-01-14T09:15:00Z"
}
]Get Specific Endpoint
Get details for a specific endpoint.
Endpoint: GET /api/endpoints/{id}
Parameters:
id(string, required): The endpoint ID
Headers:
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/jsonResponse:
{
"id": "cmf1234567890",
"name": "contact-form",
"description": "Contact form submissions",
"active": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}Create New Endpoint
Create a new API endpoint.
Endpoint: POST /api/endpoints/new
Headers:
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/jsonRequest Body:
{
"name": "contact-form",
"description": "Contact form submissions"
}Response:
{
"id": "cmf1234567890",
"name": "contact-form",
"description": "Contact form submissions",
"active": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}Update Endpoint
Update an existing endpoint.
Endpoint: PUT /api/endpoints/{id}
Parameters:
id(string, required): The endpoint ID
Headers:
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/jsonRequest Body:
{
"name": "contact-form-updated",
"description": "Updated contact form submissions",
"active": true
}Response:
{
"id": "cmf1234567890",
"name": "contact-form-updated",
"description": "Updated contact form submissions",
"active": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T11:45:00Z"
}Field Management
Get Fields for Endpoint
Get all fields configured for a specific endpoint.
Endpoint: GET /api/fields?endpointId={endpointId}
Query Parameters:
endpointId(string, required): The endpoint ID
Headers:
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/jsonResponse:
{
"data": [
{
"id": "field123",
"endpoint": "cmf1234567890",
"field_name": "name",
"data_type": "string",
"field_type": "text",
"required": true,
"active": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
{
"id": "field456",
"endpoint": "cmf1234567890",
"field_name": "email",
"data_type": "string",
"field_type": "text",
"required": true,
"active": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
]
}Create New Field
Add a new field to an endpoint.
Endpoint: POST /api/fields
Headers:
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/jsonRequest Body:
{
"endpoint": "cmf1234567890",
"field_name": "message",
"data_type": "string",
"field_type": "text",
"required": true
}Response:
{
"data": {
"id": "field789",
"endpoint": "cmf1234567890",
"field_name": "message",
"data_type": "string",
"field_type": "text",
"required": true,
"active": true,
"created_at": "2024-01-15T11:00:00Z",
"updated_at": "2024-01-15T11:00:00Z"
}
}Update Field
Update an existing field configuration.
Endpoint: PUT /api/fields/{fieldId}
Parameters:
fieldId(string, required): The field ID
Headers:
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/jsonRequest Body:
{
"field_name": "user_message",
"data_type": "string",
"field_type": "text",
"required": false,
"active": true
}Response:
{
"data": {
"id": "field789",
"endpoint": "cmf1234567890",
"field_name": "user_message",
"data_type": "string",
"field_type": "text",
"required": false,
"active": true,
"created_at": "2024-01-15T11:00:00Z",
"updated_at": "2024-01-15T11:30:00Z"
}
}Authentication Endpoints
User Login
Authenticate a user and receive access tokens.
Endpoint: POST /app/login
Headers:
Content-Type: application/jsonRequest Body:
{
"email": "user@example.com",
"password": "your-password"
}Response:
{
"user": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"username": "john_doe",
"email": "user@example.com",
"status": "approved"
}
}User Registration
Register a new user account.
Endpoint: POST /app/register
Headers:
Content-Type: application/jsonRequest Body:
{
"username": "john_doe",
"email": "user@example.com",
"password": "secure-password",
"approvalCode": "APPROVAL_CODE"
}Response:
{
"message": "User registered successfully. Account pending approval."
}Refresh Access Token
Get a new access token using a refresh token.
Endpoint: POST /app/refresh
Headers:
Authorization: Bearer YOUR_REFRESH_TOKEN
Content-Type: application/jsonResponse:
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}Using Your Custom APIs
Once you've created an endpoint with fields, you can use it to collect data.
Submit Data to Your API
Endpoint: POST /api/{endpoint-name}
Headers:
Content-Type: application/jsonRequest Body (example for contact-form endpoint):
{
"name": "John Doe",
"email": "john@example.com",
"message": "I'd like to learn more about your services"
}Response:
{
"success": true,
"message": "Data submitted successfully",
"data": {
"id": "submission123",
"name": "John Doe",
"email": "john@example.com",
"message": "I'd like to learn more about your services",
"created_at": "2024-01-15T12:00:00Z"
}
}Error Responses
Authentication Errors
401 Unauthorized:
{
"error": "token missing"
}401 Token Expired:
{
"tokenExpired": true,
"error": "token expired"
}Validation Errors
400 Bad Request:
{
"error": "validation failed",
"details": "Name is required"
}Not Found Errors
404 Not Found:
{
"error": "Endpoint not found"
}Rate Limiting
429 Too Many Requests:
{
"error": "Too many requests, please try again later",
"retryAfter": "15 minutes"
}Rate Limits
Authentication endpoints: 5 requests per 15 minutes
API endpoints: 100 requests per 15 minutes
User-specific endpoints: 200 requests per 15 minutes
Status Codes
| Code | Description |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 409 | Conflict |
| 429 | Too Many Requests |
| 500 | Internal Server Error |
Examples
Complete Contact Form API
Endpoint: POST /api/contact-form
Request:
{
"name": "Jane Smith",
"email": "jane@example.com",
"subject": "Support",
"message": "I need help with my account"
}Response:
{
"success": true,
"message": "Contact form submitted successfully",
"data": {
"id": "submission456",
"name": "Jane Smith",
"email": "jane@example.com",
"subject": "Support",
"message": "I need help with my account",
"created_at": "2024-01-15T14:30:00Z"
}
}User Feedback API
Endpoint: POST /api/user-feedback
Request:
{
"product_id": "prod123",
"rating": "5",
"review": "Excellent product!",
"recommend": true
}Response:
{
"success": true,
"message": "Feedback submitted successfully",
"data": {
"id": "feedback789",
"product_id": "prod123",
"rating": "5",
"review": "Excellent product!",
"recommend": true,
"created_at": "2024-01-15T15:45:00Z"
}
}