API Integration: Getting Started

Markdown

View as Markdown

This guide explains how to start using the Flora AI API by obtaining your API token and authenticating your requests.


1. Get Your API Token

  1. Go to the API Page:
    https://app.floraai.me/en/user/api/token/

  2. If prompted, log in to your Flora AI account.

  3. On the API page, locate your API Token.

  4. Copy the token and store it in a secure place (e.g., a password manager or environment variable).

API Token Screenshot

Important: Treat your API token like a password. Do not share it publicly or commit it to version control.


2. Authenticate Your Requests

All requests to the Flora AI API must include your API token in the Authorization header.

Use the following format:

Authorization: Token YOUR_API_TOKEN

Replace YOUR_API_TOKEN with the token you copied from the API page.


3. Example Requests

Below are some basic examples of how to include the token in different environments.

3.1. cURL Example

curl -X GET "https://api.floraai.me/v1/example-endpoint/" \  -H "Authorization: Token YOUR_API_TOKEN" \  -H "Content-Type: application/json"

3.2. JavaScript (fetch) Example

fetch("https://api.floraai.me/v1/example-endpoint/", {  method: "GET",  headers: {    "Authorization": "Token YOUR_API_TOKEN",    "Content-Type": "application/json"  }})  .then(response => response.json())  .then(data => console.log(data))  .catch(error => console.error(error));

3.3. Python (requests) Example

import requestsurl = "https://api.floraai.me/v1/example-endpoint/"headers = {    "Authorization": "Token YOUR_API_TOKEN",    "Content-Type": "application/json",}response = requests.get(url, headers=headers)print(response.status_code, response.json())

4. Best Practices

  • Use environment variables to store your API token (e.g., FLORAAI_API_TOKEN) instead of hardcoding it.

  • Rotate tokens periodically and immediately if you suspect exposure.

  • Limit access to your token to only those who need it within your organization.


5. Next Steps

Once your authentication is working:

  • Explore available endpoints in the API documentation.

  • Test requests in a development environment before using them in production.

  • Implement error handling to manage invalid tokens or expired sessions.

Was this article helpful?

Still need help?

Contact us