Skip to content

Creating Your First API

This guide walks you through creating your first API using the FG API platform.

Before You Start

Make sure you have:

  • ✅ An approved FG API account
  • ✅ Access to the platform dashboard
  • ✅ A clear idea of what data you want to collect

Step-by-Step Guide

Step 1: Access the Flow Builder

  1. Log into your FG API account
  2. Click "Flow" in the sidebar navigation
  3. You'll see the Flow Builder interface

Step 2: Name Your Endpoint

  1. In Section 1: Endpoint Setup

  2. Enter a descriptive name for your API endpoint

    • Example: user-feedback, contact-form, product-inquiry
  3. Click "Create" to create the endpoint

  4. You'll see a confirmation that your endpoint is ready

Step 3: Configure Fields

  1. Move to Section 2: Field Configuration

  2. Click "Add Field" to add data fields

  3. For each field, configure:

    • Field Name: The parameter name (e.g., name, email, message)
    • Data Type: Choose from string, number, boolean, array, or object
    • Field Type: Choose from text, single_select, multi_select, date, or object
    • Required: Check if this field is mandatory
    • Active: Check to enable the field

Step 4: Test Your Configuration

  1. Review your endpoint and fields
  2. Make sure all required fields are marked
  3. Verify field types match your data needs

Step 5: Deploy Your API

  1. Click "Complete Setup"
  2. Your API is now live and ready to use
  3. You'll receive the API endpoint URL

Example: Contact Form API

Let's create a simple contact form API:

Endpoint Setup

  • Name: contact-form

  • Description: Collect contact form submissions

Field Configuration

  1. Name Field

    • Field Name: name

    • Data Type: string

    • Field Type: text

    • Required: ✅ Yes

    • Active: ✅ Yes

  2. Email Field

    • Field Name: email

    • Data Type: string

    • Field Type: text

    • Required: ✅ Yes

    • Active: ✅ Yes

  3. Message Field

    • Field Name: message

    • Data Type: string

    • Field Type: text

    • Required: ✅ Yes

    • Active: ✅ Yes

  4. Subject Field

    • Field Name: subject

    • Data Type: string

    • Field Type: single_select

    • Options: General Inquiry, Support, Sales, Other

    • Required: ✅ Yes

    • Active: ✅ Yes

Using Your API

Once created, your API is available at:

en
POST https://your-api-domain.com/api/contact-form

Example Request

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

Example Response

json
{
  "success": true,
  "message": "Contact form submitted successfully",
  "data": {
    "id": "cmf1234567890",
    "name": "John Doe",
    "email": "john@example.com",
    "message": "I'd like to learn more about your services",
    "subject": "General Inquiry",
    "created_at": "2024-01-15T10:30:00Z"
  }
}

Field Types Explained

Text Fields

  • Use for: Names, emails, messages, descriptions

  • Data Type: string

  • Field Type: text

Select Fields

  • Single Select: Choose one option from a list

  • Multi Select: Choose multiple options from a list

  • Data Type: string or array

  • Field Type: single_select or multi_select

Date Fields

  • Use for: Birthdays, event dates, deadlines

  • Data Type: string

  • Field Type: date

Number Fields

  • Use for: Ages, quantities, prices

  • Data Type: number

  • Field Type: text (with number validation)

Boolean Fields

  • Use for: Yes/No questions, checkboxes

  • Data Type: boolean

  • Field Type: text

Best Practices

Naming Conventions

  • Use lowercase with hyphens for endpoint names: user-profile, order-tracking

  • Use descriptive field names: first_name, email_address, phone_number

  • Keep names consistent across your APIs

Field Configuration Help

  • Mark essential fields as required

  • Use appropriate data types for validation

  • Provide clear field names that users understand

Testing

  • Test your API with sample data

  • Verify all required fields work correctly

  • Check that optional fields are truly optional

Next Steps

Need Help?