DevelopersDocumentation

Lead API Integration Guide

This document describes the process of integrating partner systems with the FeelMe AI platform. It covers obtaining an access token, creating a user, and managing subscriptions via our API endpoints. All requests and responses must be in JSON format.

Overview

Sequence Diagram

The integration flow consists of three main steps:

  1. Obtain an access token (used for subsequent API calls).
  2. Create a user on the FeelMe AI portal.
  3. Create a subscription for the newly created user.

Additionally, a full set of CRUD (Create, Read, Update, Delete) operations is available for users and subscriptions. Deletion of a subscription is performed by updating the subscription’s end date to the current date. If a subscription has not started yet, it is possible to modify its start date.

The online API documentation is available at the following endpoints:

Swagger:

OpenAPI:

You can use the following base URLs:

When using these endpoints in your requests, replace ~/api/v1/ with one of the base URLs above (e.g., https://leadapi-stg.feelme.com/api/v1/).


1. Obtain Access Token

Endpoint

POST /partner/token/

Description

Partners must first obtain an access token from their backend. This token is required in the header for all subsequent API requests.

Required Headers

Request Body

{
  "scope": "admin" | "user",
  "website": "string"
}

Example curl Request (Staging)

curl -X POST "~/partner/token/" \
  -H "Authorization: Basic dGVzdF9wYXJ0bmVyOnBhc3N3b3JkMTIz" \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "admin",
    "website": "exampleSite"
  }'

Example Success Response

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5..."
}

2. Create a User

Endpoint

POST /partner/user/

Description

After obtaining the token, partners can create a new user in the FeelMe AI system.

Required Headers

Request Body

{
  "email": "user@example.com",
  "password": "string",
  "agreed_to_policies": "agreed"
}

Example curl Request (Production)

curl -X POST "~/partner/user/" \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "superSecurePassword",
    "agreed_to_policies": "agreed"
  }'

Example Success Response

{
  "id": 12345,
  "email": "user@example.com",
  "password": "string",
  "agreed_to_policies": "agreed"
}

3. Create a Subscription

Endpoint

POST /partner/subscriptions/

Description

Create one or more subscriptions for a user. If the scope of the access token is admin, you can create up to 100 subscriptions in one request. If the scope is user, you can only create 1 subscription per request.

Required Headers

Request Body

{
  "subscriptions": [
    {
      "id": 0,
      "user_email": "user@example.com",
      "website": "string",
      "starts_at": "2025-03-24T13:53:14.676Z",
      "ends_at": "2025-03-24T13:53:14.676Z"
    }
  ]
}

Example curl Request (Staging)

curl -X POST "~/partner/subscriptions/" \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "subscriptions": [
      {
        "id": 0,
        "user_email": "user@example.com",
        "website": "someSite",
        "starts_at": "2025-03-24T13:53:14.676Z",
        "ends_at": "2025-04-24T13:53:14.676Z"
      }
    ]
  }'

Example Success Response

{
  "subscriptions_created": [
    {
      "user_email": "user@example.com",
      "starts_at": "2025-03-24T13:53:14.676Z",
      "ends_at": "2025-04-24T13:53:14.676Z",
      "status": "active"
    }
  ]
}

Additional Operations

CRUD for Users and Subscriptions

A complete set of CRUD operations is supported:


Error Handling

Common HTTP status codes you may encounter:

The response body for errors usually contains an error field with a brief description, for example:

{
  "error": "Invalid subscription data"
}

Conclusion

By following these steps and ensuring correct usage of tokens, scopes, and headers, partners can integrate smoothly with the FeelMe AI platform. For any questions or additional support, please contact our technical support team.