Skip to content

App Events

Endpoint for registering mobile app events.

📥 Postman Collection

Download Collection - APP Events

URLs

MethodURLActionDescription
POST/api/v1/app/registeruserRegisterRegisters device ID in existing FanID
POST/api/v1/app/eventRegisterAdds events using User ID

Production:

{connect-producao}/api/v1/app

Staging:

{connect-homologacao}/api/v1/app

Authentication

All requests require an access token obtained from the Security endpoint. The token must be sent in the AccessToken header.

Register App User

Request

Endpoint: POST {connect-producao}/api/v1/app/registeruser

Headers:

AccessToken: {access_token}
Content-Type: application/json

Body (Email as identifier):

json
{
  "userId": "abc123def345",
  "document": "user@example.com",
  "documentType": 4,
  "appName": "APPNAME",
  "appPlatform": "android"
}

Body (CPF as identifier):

json
{
  "userId": "abc123def345",
  "document": "12345678900",
  "documentType": 1,
  "appName": "APPNAME",
  "appPlatform": "android"
}

Body Fields

FieldTypeRequiredDescription
userIdstringYesUnique device ID
documentstringYesUser's CPF or email
documentTypenumberYesType: 1 (CPF), 4 (email)
appNamestringYesApplication name
appPlatformstringYesPlatform: android, ios

Success Response

Status: 201 Created

json
{
  "header": {
    "codigo": 1,
    "msg": "User registered successfully"
  }
}

Add Events

Request

Endpoint: POST {connect-producao}/api/v1/app/event

Headers:

AccessToken: {access_token}
Content-Type: application/json

Body (First access):

json
{
  "userId": "abc123def345",
  "eventName": "first_access",
  "eventValue": null,
  "eventDate": "2025-07-28T13:00:02.135Z",
  "appName": "APPNAME"
}

Body (Route access):

json
{
  "userId": "abc123def345",
  "eventName": "page_access",
  "eventValue": "/wallet",
  "eventDate": "2025-07-28T13:00:02.135Z",
  "appName": "APPNAME"
}

Body Fields

FieldTypeRequiredDescription
userIdstringYesUnique device ID
eventNamestringYesEvent name
eventValuestring/nullNoEvent value (e.g., accessed route)
eventDatedatetimeYesEvent date (ISO 8601)
appNamestringYesApplication name

Success Response

Status: 201 Created

json
{
  "header": {
    "codigo": 1,
    "msg": "Event registered successfully"
  }
}

Implementation Example

javascript
async function registerAppUser(userData, accessToken) {
  const response = await fetch('{connect-producao}/api/v1/app/registeruser', {
    method: 'POST',
    headers: {
      'AccessToken': accessToken,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(userData)
  });

  if (!response.ok) {
    throw new Error(`Error ${response.status}: ${response.statusText}`);
  }

  return await response.json();
}

async function addEvent(eventData, accessToken) {
  const response = await fetch('{connect-producao}/api/v1/app/event', {
    method: 'POST',
    headers: {
      'AccessToken': accessToken,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(eventData)
  });

  if (!response.ok) {
    throw new Error(`Error ${response.status}: ${response.statusText}`);
  }

  return await response.json();
}

Fanbase API Documentation