Flyntlok API Documentation

Overview

This document provides detailed information on the Flyntlok API, including endpoints for login, authorization, token management, and token validation. The API is designed to facilitate secure and seamless integration with external applications, including Zapier.

Endpoints

Login Page

Endpoint: https://flyntlok.com/public-api-login.php

Description: This endpoint is used to display the login page, requiring specific parameters to initiate the OAuth2 authorization process.

Parameters:

  • client_id (string, required): The client identifier issued to the client.
  • state (string, required): An opaque value used to maintain state between the request and the callback.
  • redirect_uri (string, required): The URL to which the authorization server will send the user once the authorization process is complete.
  • response_type (string, required): The type of response desired. Typically, this should be set to code.

Example Request:

https://flyntlok.com/public-api-login.php?client_id={CLIENT_ID}&state={STATE}&redirect_uri={REDIRECT_URI}&response_type=code

Authorization Process

Endpoint: https://flyntlok.com/Internal/Security/oauth2/authorize.php

Description: This endpoint handles the OAuth2 authorization process by validating the user credentials and other required parameters. Upon successful authorization, it returns a redirect_uri containing the authorization code and state parameters.

Request Method: POST

Content-Type: application/x-www-form-urlencoded

Request Body:

  • username (string, required): The username of the user.
  • password (string, required): The password of the user.
  • client_id (string, required): The client identifier issued to the client during the registration process.
  • state (string, required): An opaque value used to maintain state between the request and the callback.
  • redirect_uri (string, required): The URL to which the authorization server will send the user once the authorization process is complete.
  • response_type (string, required): The type of response desired. This must be set to code.

Response Body:

  • redirect_uri (string): Containing the authorization code that can be exchanged for an access token and state value provided in the initial request.

Example Request:

POST https://flyntlok.com/Internal/Security/oauth2/authorize.php

Content-Type: application/x-www-form-urlencoded

username={USERNAME}&password={PASSWORD}&client_id={CLIENT_ID}&state={STATE}&redirect_uri={REDIRECT_URI}&response_type=code
 

Access Token

Endpoint: https://flyntlok.com/public_api_token_client.php

Description: This endpoint handles the exchange of the authorization code for an access token, in a manner compatible with Zapier's expectations.

Request Method: POST

Content-Type: application/x-www-form-urlencoded

Request Body:

  • client_id (string, required): The client identifier.
  • client_secret (string, required): The client secret.
  • code (string, required): The authorization code received from the authorization process.
  • grant_type(string, required): The grant type. Typically, this should be set to authorization_code.
  • redirect_uri (string, required): The URL to which the authorization server redirected the user.

Response Body:

  • expires_in (int): The duration in seconds for which the access token is valid.
  • token_type (string): The type of the token issued.
  • access_token (string): The access token issued by the authorization server.
  • refresh_token (string): The refresh token that can be used to obtain new access tokens.

Example Request:

POST https://flyntlok.com/public_api_token_client.php

Content-Type: application/x-www-form-urlencoded

client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}&code={AUTHORIZATION_CODE}&redirect_uri={REDIRECT_URI}&grant_type=authorization_code

Refresh Token

Endpoint: https://flyntlok.com/public_api_refresh_token_client.php

Description: This endpoint facilitates the token refresh process, allowing the integration to maintain a valid session without requiring repeated user authentication.

Request Method: POST

Content-Type: application/x-www-form-urlencoded

Request Body:

  • client_id (string, required): The client identifier.
  • client_secret (string, required): The client secret.
  • refresh_token (string, required): The refresh token issued by the authorization server.
  • grant_type(string, required): The grant type. Typically, this should be set to refresh_token.

Response Body:

  • expires_in (int): The duration in seconds for which the access token is valid.
  • token_type (string): The type of the token issued.
  • access_token (string): The access token issued by the authorization server.
  • refresh_token (string): The new refresh token that can be used to obtain new access tokens.

Example Request:

POST https://flyntlok.com/public_api_refresh_token_client.php

Content-Type: application/x-www-form-urlencoded

client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}&refresh_token={REFRESH_TOKEN}&grant_type="refresh_token"

Authorization Validation Endpoint

Endpoint: https://flyntlok.com/public_api_validate_auth.php

Description: This endpoint validates authorization tokens, ensuring that only authorized requests are processed.

Request Method: GET

Headers:

  • Authorization (string, required): The authorization header with the Bearer token

Response Body:

  • status (int): The HTTP status code indicating the result of the request.
  • message (string): A message indicating the result of the token validation.
  • userData (object): An object containing detailed information about the user associated with the validated token.

Example Request:

GET https://flyntlok.com/public_api_validate_auth.php

Authorization: Bearer {ACCESS_TOKEN}

 

Create Lead

Endpoint: https://flyntlok.com/public_api_create_lead.php

Description: This endpoint creates a new lead in the system. The request must include a valid authorization token.

Request Method: POST

Content-Type: application/json

Headers:

  • Authorization (string, required): The authorization header with the Bearer token

Request Body:

  • email (string, required): The email address of the lead.
  • customer_name (string, required): The name of the lead.
  • phone_number (string, required): The phone number of the lead.
  • internal_note (string, optional): An internal note regarding the lead.

Response Body:

  • status (int): The HTTP status code indicating the result of the request. Typically, this will be 200 for a successful creation.
  • message (string): A message indicating the result of the lead creation. Typically, this will be "Lead created successfully" for a successful creation.
  • lead (object): An object containing detailed information about the created lead.
    • id (string): The unique identifier of the lead.
    • name (string): The name of the lead.
    • url (string): The URL to view the lead details in the system.

Example Request:

POST https://flyntlok.com/public_api_create_lead.php

Content-Type: application/json

Authorization: Bearer {ACCESS_TOKEN}

Body: { "email": LEAD_EMAIL, "customer_name": LEAD_NAME, "phone_number": LEAD_PHONE, "internal_note": INTERNAL_NOTE }
 
© Copyright Flyntlok, Inc. 2024