AdvisorOS
v1.0 · 2026-04-22
Public API

AdvisorOS CRM — Public API

REST API for creating leads and retrieving CRM contacts. Designed for use with Make.com and other automation tools.

Veřejné API

AdvisorOS CRM — Veřejné API

REST API pro vytváření leadů a stahování kontaktů z CRM. Navrženo pro Make.com a další automatizační nástroje.

Base URL
https://api.advisoros.cz
// legacy (stále funguje / still works): https://europe-west3-advisoros-prod.cloudfunctions.net

Authentication

Every request must carry your token — preferably in the Authorization: Bearer YOUR_API_TOKEN header. The legacy token query parameter still works, but query strings end up in request logs, so prefer the header. Generate your token in the AdvisorOS app → Leads → API integration section. Every error response is JSON {"error": "..."} and API responses are never cached (Cache-Control: no-store).

Autentizace

Každý požadavek musí nést váš token — nejlépe v hlavičce Authorization: Bearer YOUR_API_TOKEN. Starší query parametr token funguje dál, ale query string končí v logu požadavků, proto dejte přednost hlavičce. Token vygenerujete v aplikaci AdvisorOS → Leady → API integrace. Každá chybová odpověď je JSON {"error": "..."} a odpovědi API se nikdy neukládají do cache (Cache-Control: no-store).

Authorization: Bearer YOUR_API_TOKEN
// legacy: ?token=YOUR_API_TOKEN
ConditionStatusResponse
Token missing401{"error": "Missing token"}
Token invalid403{"error": "Invalid token"}
Rate limit exceeded (see Retry-After header)429{"error": "Too Many Requests. Zpomalte prosím."}
StavHTTP StatusOdpověď
Token chybí401{"error": "Missing token"}
Neplatný token403{"error": "Invalid token"}
Překročen limit požadavků (viz hlavička Retry-After)429{"error": "Too Many Requests. Zpomalte prosím."}
POST

/injestLead

Creates a new lead in the authenticated user's CRM pipeline. Used by the Vytvořit lead Make.com module.

Request

Vytvoří nový lead v CRM pipeline přihlášeného uživatele. Využíváno Make.com modulem Vytvořit lead.

Požadavek

POST /injestLead
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

Body Parameters

FieldTypeRequiredMaxDescription
namestringNo100Full name. Default: "Neznámý kontakt"
emailstringNo100Email address
phonestringNo50Phone number
sourcestringNo100Traffic source. Default: "Make.com"
notesstringNo2000Additional notes

All string fields are HTML-escaped and truncated server-side.

Parametry těla požadavku

PoleTypPovinnéMaxPopis
namestringNe100Celé jméno. Výchozí: "Neznámý kontakt"
emailstringNe100E-mailová adresa
phonestringNe50Telefonní číslo
sourcestringNe100Zdroj kontaktu. Výchozí: "Make.com"
notesstringNe2000Poznámky

Všechny řetězcové hodnoty jsou na serveru HTML-escapovány a zkráceny na max. délku.

Example Request

Příklad požadavku

{
  "name": "Jan Novák",
  "email": "jan.novak@example.com",
  "phone": "+420 777 123 456",
  "source": "Facebook Ads",
  "notes": "Zájem o životní pojištění."
}

Responses

StatusBodyCause
200 OK{"success": true, "leadId": "Xk3pQ9mR2tVw7yZa1bCd"}Lead created; leadId = ID of the new lead
400{"error": "Invalid JSON body"}Body is not a JSON object
401{"error": "Missing token"}Token not provided (header or token param)
403{"error": "Invalid token"}Token does not match any user
405{"error": "Method not allowed"}Request method is not POST
429{"error": "Too Many Requests. Zpomalte prosím."}Exceeded 60 req/min per token
500{"error": "Error saving lead"}Internal server error

Rate limit: 60 requests / minute per token.

Odpovědi

StatusTěloPříčina
200 OK{"success": true, "leadId": "Xk3pQ9mR2tVw7yZa1bCd"}Lead vytvořen; leadId = ID nového leadu
400{"error": "Invalid JSON body"}Tělo požadavku není JSON objekt
401{"error": "Missing token"}Token chybí (hlavička ani parametr token)
403{"error": "Invalid token"}Token neodpovídá žádnému uživateli
405{"error": "Method not allowed"}Metoda požadavku není POST
429{"error": "Too Many Requests. Zpomalte prosím."}Překročeno 60 req/min na token
500{"error": "Error saving lead"}Interní chyba serveru

Rate limit: 60 požadavků / minutu na token.

POST

/injestEmail

Imports an e-mail into the AdvisorOS E-mail assistant, matches the sender to a client (or lead) by e-mail address and starts AI triage. Used by the Importovat e-mail Make.com module, typically after a Custom mailhook. Attachment contents are never sent — names only.

Request

Importuje e-mail do E-mailového pomocníka v AdvisorOS, podle adresy odesílatele ho spáruje s klientem (nebo leadem) a spustí AI třídění. Využíváno Make.com modulem Importovat e-mail, typicky za Custom mailhookem. Obsah příloh se nikdy neposílá — jen jejich názvy.

Požadavek

POST /injestEmail
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

Body Parameters

FieldTypeRequiredMaxDescription
fromstring (e-mail)Yes200Sender address — used to match the client
fromNamestringNo150Sender name
tostringNo200Recipient
subjectstring*300Subject
bodyTextstring*20 000Plain-text body
bodyHtmlstring*300 000HTML body (dangerous markup is stripped server-side)
receivedAtstring / numberNo—ISO 8601 or Unix ms. Default: time of import
messageIdstringNo300Original Message-ID — prevents duplicate imports
attachmentsstring / arrayNo10 filesFile names separated by ; (or an array of names)

* At least subject, bodyText or bodyHtml is required.

Parametry těla požadavku

PoleTypPovinnéMaxPopis
fromstring (e-mail)Ano200Adresa odesílatele — podle ní se páruje klient
fromNamestringNe150Jméno odesílatele
tostringNe200Příjemce
subjectstring*300Předmět
bodyTextstring*20 000Tělo jako prostý text
bodyHtmlstring*300 000Tělo v HTML (nebezpečné značky server odstraní)
receivedAtstring / numberNe—ISO 8601 nebo Unix ms. Výchozí: čas importu
messageIdstringNe300Původní Message-ID — chrání před duplicitním importem
attachmentsstring / poleNe10 souborůNázvy souborů oddělené ; (nebo pole názvů)

* Vyplňte aspoň subject, bodyText nebo bodyHtml.

Example Request

Příklad požadavku

{
  "from": "jan.novak@example.com",
  "fromName": "Jan Novák",
  "subject": "Dotaz k hypotéce",
  "bodyText": "Dobrý den, fixace mi končí v září…",
  "receivedAt": "2026-07-15T09:41:00.000Z",
  "messageId": "<CAF9xw7Zk3P2abQ8rT5mN1@mail.gmail.com>",
  "attachments": "vypis_uctu.pdf;smlouva.pdf"
}

Responses

StatusBodyCause
200 OK{"success": true, "emailId": "em3f8a…"}E-mail imported
200 OK{"success": true, "emailId": "em3f8a…", "duplicate": true}Same messageId was imported before — nothing changed
400{"error": "Invalid or missing 'from' …"}Missing / invalid sender, or empty e-mail
401{"error": "Missing token"}Token not provided (header or token param)
403{"error": "Invalid token"}Token does not match any user
405{"error": "Method not allowed"}Request method is not POST
429{"error": "Too Many Requests. Zpomalte prosím."}Exceeded 30 e-mails/min per token
500{"error": "Error saving e-mail"}Internal server error

Rate limit: 30 requests / minute per token. AI triage has its own monthly quota.

Odpovědi

StatusTěloPříčina
200 OK{"success": true, "emailId": "em3f8a…"}E-mail importován
200 OK{"success": true, "emailId": "em3f8a…", "duplicate": true}Stejné messageId už bylo importováno — nic se nezměnilo
400{"error": "Invalid or missing 'from' …"}Chybí / neplatný odesílatel nebo prázdný e-mail
401{"error": "Missing token"}Token chybí (hlavička ani parametr token)
403{"error": "Invalid token"}Token neodpovídá žádnému uživateli
405{"error": "Method not allowed"}Metoda požadavku není POST
429{"error": "Too Many Requests. Zpomalte prosím."}Překročeno 30 e-mailů/min na token
500{"error": "Error saving e-mail"}Interní chyba serveru

Rate limit: 30 požadavků / minutu na token. AI třídění má vlastní měsíční kvótu.

GET

/listNewClients

Returns CRM clients ordered oldest first (up to limit), optionally only those created after since. Used by the Sledovat nové klienty Make.com trigger module.

Query Parameters

ParameterTypeRequiredDescription
tokenstringNoLegacy only — send the token in the Authorization: Bearer header instead
sincestring / numberNoReturn clients created at or after this point: all clients from the same millisecond as since, then up to limit newer ones. Accepts Unix timestamp in ms (integer) or ISO 8601 string. Omit to return all clients.
limitintegerNoMax results. Range: 1–500. Default: 100.

Vrátí klienty z CRM od nejstaršího (nejvýše limit), volitelně jen ty vytvořené po since. Využíváno Make.com trigger modulem Sledovat nové klienty.

Query parametry

ParametrTypPovinnéPopis
tokenstringNeJen starší integrace — token posílejte v hlavičce Authorization: Bearer
sincestring / numberNeVrátí klienty vytvořené od tohoto bodu včetně: všechny ze stejné milisekundy jako since a k nim nejvýše limit novějších. Přijímá Unix timestamp v ms (integer) nebo ISO 8601 řetězec. Vynecháním se vrátí všichni klienti.
limitintegerNeMax. počet výsledků. Rozsah: 1–500. Výchozí: 100.

Example Request

Příklad požadavku

GET /listNewClients?since=2025-11-03T17:53:00.000Z&limit=50
Authorization: Bearer YOUR_API_TOKEN

Success Response — 200 OK

Úspěšná odpověď — 200 OK

{
  "clients": [
    {
      "id": "abc123def456",
      "firstName": "Jan",
      "lastName": "Novák",
      "email": "jan.novak@example.com",
      "phone": "+420 777 123 456",
      "dateOfBirth": "1985-03-14",
      "createdAt": "2025-11-03T17:53:00.000Z"
    }
  ]
}

Response Fields

FieldTypeDescription
idstringUnique Firestore document ID of the client
firstNamestringFirst name
lastNamestringLast name
emailstringEmail address
phonestringPhone number
dateOfBirthstringDate of birth as YYYY-MM-DD. Empty when not filled in.
createdAtstring (ISO 8601) | nullCreation timestamp. null for legacy records.

Results are ordered by createdAt ascending. Clients without a createdAt value are included only when since is not provided.

Pole odpovědi

PoleTypPopis
idstringUnikátní ID dokumentu klienta ve Firestore
firstNamestringKřestní jméno
lastNamestringPříjmení
emailstringE-mailová adresa
phonestringTelefonní číslo
dateOfBirthstringDatum narození ve tvaru RRRR-MM-DD. Prázdné, když není vyplněné.
createdAtstring (ISO 8601) | nullČas vytvoření. null u starších záznamů bez časového razítka.

Výsledky jsou seřazeny vzestupně dle createdAt. Klienti bez createdAt jsou zahrnuti pouze tehdy, když parametr since není zadán.

Error Responses

StatusBodyCause
200 OK{"clients": [...]}Success
401{"error": "Missing token"}Token not provided (header or token param)
403{"error": "Invalid token"}Token does not match any user
405{"error": "Method not allowed"}Request method is not GET
429{"error": "Too Many Requests. Zpomalte prosím."}Exceeded 120 req/min per token
500{"error": "Server error"}Internal server error

Rate limit: 120 requests / minute per token.

Chybové odpovědi

StatusTěloPříčina
200 OK{"clients": [...]}Úspěch
401{"error": "Missing token"}Token chybí (hlavička ani parametr token)
403{"error": "Invalid token"}Token neodpovídá žádnému uživateli
405{"error": "Method not allowed"}Metoda požadavku není GET
429{"error": "Too Many Requests. Zpomalte prosím."}Překročeno 120 req/min na token
500{"error": "Server error"}Interní chyba serveru

Rate limit: 120 požadavků / minutu na token.

GET

/listNewLeadMagnetSubmissions

Returns lead magnet form submissions captured from public Linktree-style profile cards (MarketingOS — Lead Magnet block). Used by the Sledovat nová stažení lead magnetu Make.com trigger module.

Query Parameters

ParameterTypeRequiredDescription
tokenstringNoLegacy only — send the same token in the Authorization: Bearer header instead
sincestring / numberNoReturn submissions created at or after this point: all from the same millisecond as since, then up to limit newer ones. Accepts Unix timestamp in ms (integer) or ISO 8601 string. Omit to return all submissions.
limitintegerNoMax results. Range: 1–500. Default: 100.

Vrátí seznam odeslaných formulářů z lead magnet bloků na veřejných vizitkách (MarketingOS — Lead Magnet). Využíváno Make.com trigger modulem Sledovat nová stažení lead magnetu.

Query parametry

ParametrTypPovinnéPopis
tokenstringNeJen starší integrace — stejný token posílejte v hlavičce Authorization: Bearer
sincestring / numberNeVrátí submissions vytvořené od tohoto bodu včetně: všechny ze stejné milisekundy jako since a k nim nejvýše limit novějších. Přijímá Unix timestamp v ms (integer) nebo ISO 8601 řetězec. Vynecháním se vrátí všechny.
limitintegerNeMax. počet výsledků. Rozsah: 1–500. Výchozí: 100.

Example Request

Příklad požadavku

GET /listNewLeadMagnetSubmissions?since=2026-05-04T10:15:30.000Z&limit=50
Authorization: Bearer YOUR_API_TOKEN

Success Response — 200 OK

Úspěšná odpověď — 200 OK

{
  "submissions": [
    {
      "id": "abc123def",
      "blockId": "k7g3m9p2x",
      "blockTitle": "10 finančních triků pro rok 2026",
      "pdfFileName": "10-financnich-triku.pdf",
      "email": "jan.novak@example.com",
      "firstName": "Jan",
      "lastName": "Novák",
      "phone": "+420 777 123 456",
      "source": "MarketingOS: Lead Magnet",
      "createdAt": "2026-05-04T10:15:30.000Z"
    }
  ]
}

Response Fields

FieldTypeDescription
idstringUnique Firestore document ID of the submission
blockIdstringID of the lead magnet block on the user's profile card
blockTitlestringVisible title of the lead magnet
pdfFileNamestringOriginal filename of the gated PDF
emailstringContact email (always present — required field)
firstNamestringFirst name (only if the block requested it)
lastNamestringLast name (only if the block requested it)
phonestringPhone number (only if the block requested it)
sourcestringTraffic source attribution (e.g. direct, instagram, facebook)
createdAtstring (ISO 8601) | nullSubmission timestamp

Results are ordered by createdAt ascending. Optional fields not requested by the block come back as empty strings.

Pole odpovědi

PoleTypPopis
idstringUnikátní ID dokumentu odeslání ve Firestore
blockIdstringID lead magnet bloku na vizitce
blockTitlestringNázev lead magnetu (zobrazený klientovi)
pdfFileNamestringPůvodní název nahraného PDF
emailstringE-mailová adresa (vždy přítomna — povinné pole)
firstNamestringKřestní jméno (jen pokud blok pole vyžaduje)
lastNamestringPříjmení (jen pokud blok pole vyžaduje)
phonestringTelefon (jen pokud blok pole vyžaduje)
sourcestringZdroj návštěvnosti (např. direct, instagram, facebook)
createdAtstring (ISO 8601) | nullČas odeslání formuláře

Výsledky jsou seřazeny vzestupně dle createdAt. Volitelná pole, která blok nevyžaduje, se vrací jako prázdný řetězec.

Error Responses

StatusBodyCause
200 OK{"submissions": [...]}Success
401{"error": "Missing token"}Token not provided (header or token param)
403{"error": "Invalid token"}Token does not match any user
405{"error": "Method not allowed"}Request method is not GET
429{"error": "Too Many Requests. Zpomalte prosím."}Exceeded 120 req/min per token
500{"error": "Server error"}Internal server error

Rate limit: 120 requests / minute per token.

Chybové odpovědi

StatusTěloPříčina
200 OK{"submissions": [...]}Úspěch
401{"error": "Missing token"}Token chybí (hlavička ani parametr token)
403{"error": "Invalid token"}Token neodpovídá žádnému uživateli
405{"error": "Method not allowed"}Metoda požadavku není GET
429{"error": "Too Many Requests. Zpomalte prosím."}Překročeno 120 req/min na token
500{"error": "Server error"}Interní chyba serveru

Rate limit: 120 požadavků / minutu na token.

GET

/validateApiToken

Validates an API token and returns the owner's profile metadata. Used by the Make.com app for connection testing and metadata population (so the owner's email shows next to the connection in the Make.com UI).

Query Parameters

ParameterTypeRequiredDescription
tokenstringNoLegacy only — send the token in the Authorization: Bearer header instead

Ověří platnost API tokenu a vrátí metadata vlastníka. Používá Make.com aplikace pro test connectionu a vyplnění metadat (aby se v Make.com UI u připojení zobrazil e-mail vlastníka tokenu místo náhodného ID).

Query parametry

ParametrTypPovinnéPopis
tokenstringNeJen starší integrace — token posílejte v hlavičce Authorization: Bearer

Example Request

Příklad požadavku

GET /validateApiToken
Authorization: Bearer YOUR_API_TOKEN

Success Response — 200 OK

Úspěšná odpověď — 200 OK

{
  "email": "advisor@example.cz",
  "name": "Jan Novák",
  "uid": "abc123def456"
}

Response Fields

FieldTypeDescription
emailstringContact email of the token owner (from the AdvisorOS profile)
namestringDisplay name of the token owner
uidstringInternal user ID (Firebase Auth UID)

Pole odpovědi

PoleTypPopis
emailstringKontaktní e-mail vlastníka tokenu (z profilu v AdvisorOS)
namestringZobrazované jméno vlastníka tokenu
uidstringInterní ID uživatele (Firebase Auth UID)

Error Responses

StatusBodyCause
401{"error": "Missing token"}Token not provided (header or token param)
403{"error": "Invalid token"}Token does not match any user
405{"error": "Method not allowed"}Request method is not GET
429{"error": "Too Many Requests. Zpomalte prosím."}Exceeded 60 req/min per token
500{"error": "Server error"}Internal server error

Rate limit: 60 requests / minute per token.

Chybové odpovědi

StatusTěloPříčina
401{"error": "Missing token"}Token chybí (hlavička ani parametr token)
403{"error": "Invalid token"}Token neodpovídá žádnému uživateli
405{"error": "Method not allowed"}Metoda požadavku není GET
429{"error": "Too Many Requests. Zpomalte prosím."}Překročeno 60 req/min na token
500{"error": "Server error"}Interní chyba serveru

Rate limit: 60 požadavků / minutu na token.

Make.com Integration

This API powers the AdvisorOS CRM app on Make.com. Module mapping:

Make.com moduleEndpoint
Sledovat nové klientyGET /listNewClients
Sledovat nová stažení lead magnetuGET /listNewLeadMagnetSubmissions
Vytvořit leadPOST /injestLead
Importovat e-mailPOST /injestEmail
Make an API callany endpoint abovelibovolný endpoint výše

All modules share a single connection (apiToken), sent as Authorization: Bearer. No separate credential is needed.

Trigger cursor behaviour

Both watch triggers remember the createdAt of the last processed item ({{data.lastDate}}) and send it as since on the next poll, together with limit. The API returns items from that point on, oldest first: every item that shares the exact time of since (e.g. a bulk import) plus up to limit newer ones. Make skips the items it already emitted, so a backlog drains in order without gaps and the trigger never stalls on a large group. since accepts ISO 8601 strings and Unix timestamps in milliseconds.

Connection verification

The Make.com connection test calls GET /validateApiToken with the Authorization: Bearer header. A 403 response means the token is invalid; a 200 response returns the owner's email/name (used to populate connection metadata in the Make.com UI).

Integrace s Make.com

Toto API pohání aplikaci AdvisorOS CRM na Make.com. Mapování modulů:

Make.com modulEndpoint
Sledovat nové klientyGET /listNewClients
Sledovat nová stažení lead magnetuGET /listNewLeadMagnetSubmissions
Vytvořit leadPOST /injestLead
Importovat e-mailPOST /injestEmail
Make an API callany endpoint abovelibovolný endpoint výše

Všechny moduly sdílí jedno připojení (apiToken), posílané v hlavičce Authorization: Bearer. Žádné další přihlašovací údaje nejsou potřeba.

Chování kurzoru triggeru

Oba watch triggery si pamatují createdAt posledního zpracovaného záznamu ({{data.lastDate}}) a při dalším dotazu ho pošlou jako since spolu s limit. API vrátí záznamy od tohoto bodu, od nejstaršího: všechny se stejným časem jako since (např. hromadný import) a k nim nejvýše limit novějších. Make už zpracované záznamy přeskočí, takže se nahromaděné záznamy zpracují postupně, žádný se nevynechá a trigger se na velké skupině nezasekne. since přijímá ISO 8601 i Unix timestamp v milisekundách.

Ověření připojení

Test připojení v Make.com volá GET /validateApiToken s hlavičkou Authorization: Bearer. Odpověď 403 znamená neplatný token; odpověď 200 vrátí e-mail a jméno vlastníka tokenu (použito pro vyplnění metadat connectionu v Make.com UI).

Changelog

VersionDateNotes
1.02026-04-22Initial public API release — injestLead + listNewClients
1.12026-05-05Added listNewLeadMagnetSubmissions polling endpoint for MarketingOS lead magnet capture
1.22026-05-05Added validateApiToken connection-test endpoint (returns owner email + name); normalized all injestLead error responses to JSON {error: "..."}
1.32026-10-22New base URL https://api.advisoros.cz (the cloudfunctions.net URL keeps working); token in the Authorization: Bearer header; injestLead returns leadId and 400 for an invalid body; every error incl. 405 is JSON; Retry-After on 429; documented injestEmail

Historie změn

VerzeDatumPoznámky
1.02026-04-22První veřejné vydání API — injestLead + listNewClients
1.12026-05-05Přidán polling endpoint listNewLeadMagnetSubmissions pro sběr leadů z MarketingOS lead magnet bloků
1.22026-05-05Přidán endpoint validateApiToken pro test connectionu v Make.com (vrací e-mail + jméno vlastníka); error responses v injestLead normalizovány na JSON {error: "..."}
1.32026-10-22Nová adresa https://api.advisoros.cz (adresa cloudfunctions.net funguje dál); token v hlavičce Authorization: Bearer; injestLead vrací leadId a 400 při neplatném těle; každá chyba vč. 405 je JSON; Retry-After u 429; zdokumentován injestEmail