Skip to content

API Endpoints Reference

This reference covers all available API endpoints in the FG API platform.

Base URL

All API endpoints are available at:

en
    
https://your-api-domain.com/api/

Authentication

Most endpoints require authentication. Include your access token in the Authorization header:

en
Authorization: Bearer YOUR_ACCESS_TOKEN

Endpoint Management

List All Endpoints

Get a list of all available endpoints.

Endpoint: GET /api/endpoints

Headers:

en
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

Response:

json
[
  {
    "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:

en

Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

Response:

json
{
  "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:

en
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

Request Body:

json
{
  "name": "contact-form",
  "description": "Contact form submissions"
}

Response:

json
{
  "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:

en
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

Request Body:

json
{
  "name": "contact-form-updated",
  "description": "Updated contact form submissions",
  "active": true
}

Response:

json
{
  "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:

en
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

Response:

json
{
  "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:

en
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

Request Body:

json
{
  "endpoint": "cmf1234567890",
  "field_name": "message",
  "data_type": "string",
  "field_type": "text",
  "required": true
}

Response:

json
{
  "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:

en
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

Request Body:

json
{
  "field_name": "user_message",
  "data_type": "string",
  "field_type": "text",
  "required": false,
  "active": true
}

Response:

json
{
  "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:

en
Content-Type: application/json

Request Body:

json
{
  "email": "user@example.com",
  "password": "your-password"
}

Response:

json
{
  "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:

en
Content-Type: application/json

Request Body:

json
{
  "username": "john_doe",
  "email": "user@example.com",
  "password": "secure-password",
  "approvalCode": "APPROVAL_CODE"
}

Response:

json
{
  "message": "User registered successfully. Account pending approval."
}

Refresh Access Token

Get a new access token using a refresh token.

Endpoint: POST /app/refresh

Headers:

en
Authorization: Bearer YOUR_REFRESH_TOKEN
Content-Type: application/json

Response:

json
{
  "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:

en
Content-Type: application/json

Request Body (example for contact-form endpoint):

json
{
  "name": "John Doe",
  "email": "john@example.com",
  "message": "I'd like to learn more about your services"
}

Response:

json
{
  "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:

json
{
  "error": "token missing"
}

401 Token Expired:

json
{
  "tokenExpired": true,
  "error": "token expired"
}

Validation Errors

400 Bad Request:

json
{
  "error": "validation failed",
  "details": "Name is required"
}

Not Found Errors

404 Not Found:

json
{
  "error": "Endpoint not found"
}

Rate Limiting

429 Too Many Requests:

json
{
  "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

CodeDescription
200Success
201Created
400Bad Request
401Unauthorized
403Forbidden
404Not Found
409Conflict
429Too Many Requests
500Internal Server Error

Examples

Complete Contact Form API

Endpoint: POST /api/contact-form

Request:

json
{
  "name": "Jane Smith",
  "email": "jane@example.com",
  "subject": "Support",
  "message": "I need help with my account"
}

Response:

json
{
  "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:

json
{
  "product_id": "prod123",
  "rating": "5",
  "review": "Excellent product!",
  "recommend": true
}

Response:

json
{
  "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"
  }
}