{"openapi":"3.1.1","info":{"title":"Magnetly API","version":"v1","description":"The Magnetly API gives your code, Zapier, Make or n8n the **leads** of a workspace. Each time a visitor completes one of its tools (a product quiz, a calculator, a lead form), Magnetly records a lead. List them with `GET /leads`, or subscribe a URL with `POST /hooks` to receive each new one as it happens.\n\n## Get an API key\n\nIn Magnetly, open **Workspace settings > Integrations > Developers** and click **Create key**. The key starts with `mgk_` and is shown once. It reaches one workspace, read and write. Create one key per app, so that revoking one leaves the others working.\n\n## Base URL\n\n`https://v2.magnetly.co/api/v1`\n\nJSON in and out, UTF-8. Dates are ISO 8601 in UTC. Ids are opaque strings with a prefix (`ws_`, `tl_`, `ses_`, `dst_`, `dlv_`). Call the API from a server, never from a browser: the key would leak.\n\n## Authentication\n\nSend the key as a bearer token:\n\n```http\nAuthorization: Bearer mgk_…\n```\n\nZapier and Make sign in with OAuth instead (authorization code, PKCE S256): see the `oauth2` scheme. Their access tokens are used the same way.\n\n## Quick start\n\n```bash\ncurl https://v2.magnetly.co/api/v1/me -H \"Authorization: Bearer $MAGNETLY_API_KEY\"\n```\n\n## Errors\n\nEvery error has a status and a JSON body `{\"code\", \"message\"}`: `code` is stable, for code; `message` is for people and may change.\n\n## Rate limits\n\n120 per minute per API key or connection, 600 per minute per workspace, and 100 per hour for `POST /hooks` and `DELETE /hooks/{id}` per workspace. Past a limit: `429 RATE_LIMITED` with a `Retry-After` header, in seconds.\n\n## OpenAPI\n\nThis reference is generated from [openapi.json](https://v2.magnetly.co/api/v1/openapi.json) (OpenAPI 3.1)."},"servers":[{"url":"https://v2.magnetly.co/api/v1"}],"security":[{"apiKey":[]},{"oauth2":[]}],"tags":[{"name":"Workspace","description":"Who the credential is."},{"name":"Tools","description":"The tools of the workspace."},{"name":"Leads","description":"The visitors who completed a tool."},{"name":"Hooks","description":"REST hooks: subscribe a URL when an automation is turned on, unsubscribe it when it is turned off."},{"name":"Reference","description":"This document."}],"paths":{"/me":{"get":{"operationId":"getMe","tags":["Workspace"],"summary":"Get the connected workspace","description":"The workspace the credential reaches, and who it is: the API key, or the OAuth connection. Use it to test a connection and to label it.","responses":{"200":{"description":"The workspace and the credential.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"},"examples":{"apiKey":{"summary":"With an API key","value":{"workspace":{"id":"ws_00000000008008000000001d3q","name":"Maison Lune"},"api_key":{"prefix":"mgk_3q2ZpA7c","name":"Zapier"},"connection":null,"label":"Maison Lune (Zapier)"}},"oauth":{"summary":"With an OAuth access token","value":{"workspace":{"id":"ws_00000000008008000000001d3q","name":"Maison Lune"},"api_key":null,"connection":{"app":"zapier","email":"anna@example.com"},"label":"Maison Lune (anna@example.com)"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/NotInPlan"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/tools":{"get":{"operationId":"listTools","tags":["Tools"],"summary":"List tools","description":"The tools of the workspace, by name; deleted ones never. Use it to offer a choice of the tool to filter leads or a hook on.","responses":{"200":{"description":"The tools.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolList"},"examples":{"tools":{"value":{"data":[{"id":"tl_00000000008008000000001h3q","name":"Skin routine quiz","published":true},{"id":"tl_06b2z9y8x7w6v5t4s3r2q1p0n9","name":"Draft calculator","published":false}]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/NotInPlan"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/leads":{"get":{"operationId":"listLeads","tags":["Leads"],"summary":"List leads","description":"The leads of the workspace, newest first, each with every section. Leads of the merchant's Preview and of deleted tools are never listed. For a polling trigger, call it without `before` and deduplicate on `id`.","parameters":[{"name":"limit","in":"query","description":"Leads per page.","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"tool","in":"query","description":"A tool of the workspace (`tl_…`): its leads only.","schema":{"type":"string"}},{"name":"before","in":"query","description":"The `id` of the last lead of the previous page: the leads submitted before it.","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of leads.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadList"},"examples":{"page":{"value":{"data":[{"id":"ses_0000000000800800000000193q","object":"lead","submitted_at":"2026-12-01T10:12:04Z","workspace":{"id":"ws_00000000008008000000001d3q","name":"Maison Lune"},"tool":{"id":"tl_00000000008008000000001h3q","name":"Skin routine quiz","version":7},"contact":{"email":"ana@example.com","first_name":"Ana","last_name":null,"phone":null,"linkedin_url":null,"consent":{"given":true,"text":"I agree to receive emails."}},"answers":[{"key":"skin_type","question":"Your skin type?","answer":"Dry","value":"dry"}],"answers_by_key":{"skin_type":"Dry"},"output":[{"key":"headline","label":"Headline","value":"A gentle routine for dry skin"}],"output_by_key":{"headline":"A gentle routine for dry skin"},"recommended_products":[{"id":"sku_12","name":"Hydra cream","price":"29.00 EUR","image_url":"https://example.com/hydra-cream.jpg","url":"https://example.com/products/hydra-cream?utm_source=magnetly&utm_medium=inline&utm_campaign=skin-routine-quiz","cart_url":"https://example.com/cart/44501:1?storefront=true&utm_source=magnetly&utm_medium=inline&utm_campaign=skin-routine-quiz","reason":"Rich texture for dry skin"}],"cart_url":"https://example.com/cart/44501:1?storefront=true&utm_source=magnetly&utm_medium=inline&utm_campaign=skin-routine-quiz","cart_mode":"cart","provenance":{"channel":"inline","page":"maisonlune.fr/quiz","referrer_host":"google.com","device":"mobile","utm":{"utm_source":"instagram"},"embed_id":"em_00000000008008000000001n3q"}}],"has_more":false}}}}}},"400":{"description":"A parameter out of shape.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"INVALID_REQUEST":{"value":{"code":"INVALID_REQUEST","message":"limit must be a whole number from 1 to 100."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/NotInPlan"},"404":{"description":"`tool` is not a tool of this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"NOT_FOUND":{"value":{"code":"NOT_FOUND","message":"Tool not found."}}}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/hooks":{"post":{"operationId":"createHook","tags":["Hooks"],"summary":"Subscribe a hook","description":"Subscribes a URL to the workspace's new leads: each one is POSTed to it (see the `lead.created` webhook). Leads from before the subscription are not sent: read them with `GET /leads`. Keep `id`, to unsubscribe, and `signing_secret`, to verify each delivery: it is given only in this answer. A workspace keeps 50 lead destinations at most, hooks included. The hook appears in Integrations, where the merchant can pause or delete it.","requestBody":{"required":true,"description":"JSON, at most 4000 bytes; `url` at most 2048 characters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateHookRequest"},"examples":{"zapier":{"value":{"url":"https://hooks.zapier.com/hooks/standard/123/abc","app":"zapier"}}}}}},"responses":{"201":{"description":"The hook, with its signing secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Hook"},"examples":{"hook":{"value":{"id":"dst_06d4q7w2e9r1t5y8u3i6o0p4a2","url":"https://hooks.zapier.com/hooks/standard/123/abc","tool":null,"app":"zapier","signing_secret":"whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD"}}}}}},"400":{"description":"A body or a URL refused.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"INVALID_REQUEST":{"value":{"code":"INVALID_REQUEST","message":"The body must be {url, tool?, app?}: app one of zapier, make, n8n, other."}},"INVALID_JSON":{"value":{"code":"INVALID_JSON","message":"The request body must be valid JSON."}},"INVALID_URL":{"value":{"code":"INVALID_URL","message":"url must point to a public address."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The workspace's trial has ended: it is read-only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"TRIAL_ENDED":{"value":{"code":"TRIAL_ENDED","message":"This workspace's trial has ended."}}}}}},"403":{"$ref":"#/components/responses/NotInPlan"},"404":{"description":"`tool` is not a tool of this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"NOT_FOUND":{"value":{"code":"NOT_FOUND","message":"Tool not found."}}}}}},"409":{"description":"The workspace has no room for another destination.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"DESTINATION_LIMIT":{"value":{"code":"DESTINATION_LIMIT","message":"This workspace already has 50 lead destinations. Delete one first."}}}}}},"413":{"description":"The body is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"PAYLOAD_TOO_LARGE":{"value":{"code":"PAYLOAD_TOO_LARGE","message":"The request body must not exceed 4000 bytes."}}}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/hooks/{id}":{"delete":{"operationId":"deleteHook","tags":["Hooks"],"summary":"Unsubscribe a hook","description":"Unsubscribes a hook created through this API, with its delivery log. Allowed on a read-only workspace. A webhook the merchant made in Integrations cannot be deleted here.","parameters":[{"name":"id","in":"path","required":true,"description":"The hook's `id` (`dst_…`).","schema":{"type":"string"}}],"responses":{"204":{"description":"Unsubscribed."},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/NotInPlan"},"404":{"description":"Not a hook of this workspace, or already gone.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"NOT_FOUND":{"value":{"code":"NOT_FOUND","message":"Hook not found."}}}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/openapi.json":{"get":{"operationId":"getOpenApiDocument","tags":["Reference"],"summary":"Get this document","description":"The OpenAPI 3.1 document of this API. No authentication.","security":[],"responses":{"200":{"description":"The document.","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"webhooks":{"lead.created":{"post":{"operationId":"leadCreated","tags":["Hooks"],"summary":"A new lead","description":"Each lead completed after a hook was subscribed is POSTed to its URL, within seconds, after [Standard Webhooks](https://www.standardwebhooks.com). `data` is the lead with every section.\n\n## Answering\n\n- Any `2xx` within 10 seconds is a success; the body of the answer is ignored. Redirects are not followed.\n- Timeouts, network errors, `408`, `429` and `5xx` are retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h, 24 h (8 attempts in all), or later when `Retry-After` asks for longer, up to 24 h. Then the delivery is marked failed; the merchant can retry it from its log.\n- `410 Gone` deletes the hook at once: answer it when an automation was removed without unsubscribing.\n- `401` or `403` pauses the hook until the merchant resumes it in Integrations. Any other `4xx` fails that delivery without retry.\n- `webhook-id` is the same at every retry of a delivery: deduplicate on it. The order of deliveries is not guaranteed.\n\n## Verifying the signature\n\n`webhook-signature` is `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with the base64-decoded part of the hook's `signing_secret` after `whsec_`. Verify it on the raw body, before parsing it, and refuse a timestamp more than 5 minutes away. The `standardwebhooks` packages (npm, PyPI and others) do it with the same secret. In Node:\n\n```js\nimport { createHmac, timingSafeEqual } from \"node:crypto\";\n\n/** Whether a delivery is Magnetly's: rawBody, the exact bytes received, as a string. */\nexport function verifyMagnetlyWebhook(headers, rawBody, signingSecret, toleranceSeconds = 300) {\n  const id = headers[\"webhook-id\"];\n  const timestamp = headers[\"webhook-timestamp\"];\n  const signatures = headers[\"webhook-signature\"];\n  if (!id || !timestamp || !signatures) return false;\n  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > toleranceSeconds) return false;\n\n  const key = Buffer.from(signingSecret.replace(/^whsec_/, \"\"), \"base64\");\n  const expected = createHmac(\"sha256\", key).update(`${id}.${timestamp}.${rawBody}`).digest();\n  // Several signatures may be sent, space-separated: any one will do.\n  return signatures.split(\" \").some((entry) => {\n    const [version, signature] = entry.split(\",\");\n    if (version !== \"v1\" || !signature) return false;\n    const received = Buffer.from(signature, \"base64\");\n    return received.length === expected.length && timingSafeEqual(received, expected);\n  });\n}\n```","security":[],"parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The delivery's id (`dlv_…`), the same at every retry.","schema":{"type":"string"},"example":"dlv_00000000008008000000001s3q"},{"name":"webhook-timestamp","in":"header","required":true,"description":"When this attempt was signed, in seconds since the Unix epoch.","schema":{"type":"string"},"example":"1796119925"},{"name":"webhook-signature","in":"header","required":true,"description":"`v1,<base64 HMAC-SHA256>`, keyed with the hook's `signing_secret`.","schema":{"type":"string"},"example":"v1,pehDeWbCR9K+GEOy+RN2uGXH+j55xr2EUoTihXnPoCw="}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadCreatedEvent"},"examples":{"lead":{"summary":"Signed with whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD","value":{"type":"lead.created","timestamp":"2026-12-01T10:12:05.120Z","data":{"id":"ses_0000000000800800000000193q","object":"lead","submitted_at":"2026-12-01T10:12:04Z","workspace":{"id":"ws_00000000008008000000001d3q","name":"Maison Lune"},"tool":{"id":"tl_00000000008008000000001h3q","name":"Skin routine quiz","version":7},"contact":{"email":"ana@example.com","first_name":"Ana","last_name":null,"phone":null,"linkedin_url":null,"consent":{"given":true,"text":"I agree to receive emails."}},"answers":[{"key":"skin_type","question":"Your skin type?","answer":"Dry","value":"dry"}],"answers_by_key":{"skin_type":"Dry"},"output":[{"key":"headline","label":"Headline","value":"A gentle routine for dry skin"}],"output_by_key":{"headline":"A gentle routine for dry skin"},"recommended_products":[{"id":"sku_12","name":"Hydra cream","price":"29.00 EUR","image_url":"https://example.com/hydra-cream.jpg","url":"https://example.com/products/hydra-cream?utm_source=magnetly&utm_medium=inline&utm_campaign=skin-routine-quiz","cart_url":"https://example.com/cart/44501:1?storefront=true&utm_source=magnetly&utm_medium=inline&utm_campaign=skin-routine-quiz","reason":"Rich texture for dry skin"}],"cart_url":"https://example.com/cart/44501:1?storefront=true&utm_source=magnetly&utm_medium=inline&utm_campaign=skin-routine-quiz","cart_mode":"cart","provenance":{"channel":"inline","page":"maisonlune.fr/quiz","referrer_host":"google.com","device":"mobile","utm":{"utm_source":"instagram"},"embed_id":"em_00000000008008000000001n3q"}}}}}}}},"responses":{"200":{"description":"Received. Any 2xx will do."},"410":{"description":"Gone: Magnetly deletes the hook."}}}}},"components":{"schemas":{"Error":{"type":"object","properties":{"code":{"type":"string","description":"Stable, for code.","examples":["NOT_FOUND"]},"message":{"type":"string","description":"English, for people; may change.","examples":["Tool not found."]}},"required":["code","message"],"description":"Every error: its status and this body."},"Me":{"type":"object","properties":{"workspace":{"type":"object","properties":{"id":{"type":"string","description":"`ws_…`","examples":["ws_06b1t4cz8e9q0m2c3x6v5n4r7k"]},"name":{"type":"string","examples":["Maison Lune"]}},"required":["id","name"],"description":"The workspace the credential reaches."},"api_key":{"anyOf":[{"type":"object","properties":{"prefix":{"type":"string","description":"The key's first 12 characters, as Integrations lists it.","examples":["mgk_3q2ZpA7c"]},"name":{"type":"string","examples":["Zapier"]}},"required":["prefix","name"]},{"type":"null"}],"description":"The API key, or null for an OAuth connection."},"connection":{"anyOf":[{"type":"object","properties":{"app":{"type":"string","enum":["zapier","make"]},"email":{"type":"string","description":"The email of the account that connected the app."}},"required":["app","email"]},{"type":"null"}],"description":"The OAuth connection of Zapier or Make, or null for an API key."},"label":{"type":"string","description":"The workspace's name, then the key's name or the account's email.","examples":["Maison Lune (Zapier)"]}},"required":["workspace","api_key","connection","label"]},"ToolList":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"`tl_…`","examples":["tl_06b2k3m4n5p6q7r8s9t0v1w2x3"]},"name":{"type":"string","examples":["Skin routine quiz"]},"published":{"type":"boolean","description":"Whether visitors can open it now, so that new leads may come from it."}},"required":["id","name","published"]},"description":"By name."}},"required":["data"]},"Lead":{"type":"object","properties":{"id":{"type":"string","description":"`ses_…`: the lead, the same in `GET /leads` and in deliveries.","examples":["ses_06c8m2k4p6r8t0v2x4z6b8d0f2"]},"object":{"type":"string","const":"lead"},"submitted_at":{"type":"string","format":"date-time","description":"When the visitor completed the tool, UTC, to the second."},"workspace":{"type":"object","properties":{"id":{"type":"string","description":"`ws_…`","examples":["ws_06b1t4cz8e9q0m2c3x6v5n4r7k"]},"name":{"type":"string","examples":["Maison Lune"]}},"required":["id","name"]},"tool":{"type":"object","properties":{"id":{"type":"string","description":"`tl_…`"},"name":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"The version of the tool the visitor ran."}},"required":["id","name","version"],"description":"The tool the visitor completed."},"contact":{"type":"object","properties":{"email":{"type":["string","null"]},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"phone":{"type":["string","null"]},"linkedin_url":{"type":["string","null"]},"consent":{"type":"object","properties":{"given":{"type":"boolean","description":"False when the tool asks for no consent."},"text":{"description":"The words the visitor agreed to, or null.","type":["string","null"]}},"required":["given","text"],"description":"The consent box of the tool."}},"required":["email","first_name","last_name","phone","linkedin_url","consent"],"description":"What the visitor left, each field null when the tool did not ask for it. Personal data: store it under the merchant's privacy terms."},"answers":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"The question's variable, stable across versions."},"question":{"type":"string","description":"As the visitor read it."},"answer":{"type":"string","description":"In the visitor's words: option labels, a number with its unit."},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"array","items":{"type":"string"}}],"description":"As stored: an option's value, a number, an array for several choices."}},"required":["key","question","answer","value"]},"description":"Each other answer, in the tool's order."},"answers_by_key":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"},"description":"`key` → `answer`, for mapping fields in no-code tools."},"output":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"value":{"description":"A string, a number or an array. A whole http(s) link in it carries the `utm_*` the result screen adds to its links."}},"required":["key","label","value"]},"description":"What the result screen said, field by field."},"output_by_key":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"`key` → `value`."},"recommended_products":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The product's id in the merchant's catalogue."},"name":{"type":["string","null"]},"price":{"description":"Formatted with its currency.","type":["string","null"]},"image_url":{"type":["string","null"]},"url":{"description":"The product's page as the visitor's result screen linked it, with its `utm_*`.","type":["string","null"]},"cart_url":{"description":"The link that put this product alone in the store's cart or checkout, as the visitor got it; null when the result screen offers none.","type":["string","null"]},"reason":{"type":"string"}},"required":["id","name","price","image_url","url","cart_url","reason"]},"description":"The products the result recommended; `name`, `price`, `image_url`, `url` and `cart_url` are null for a product removed from the catalogue since."},"cart_url":{"description":"The link that put every recommended product in the store's cart (`cart_mode` `cart`, the result screen's Add all to cart) or its checkout (`checkout`, Check out all), as the visitor got it; null when there is none.","type":["string","null"]},"cart_mode":{"anyOf":[{"type":"string","enum":["cart","checkout"]},{"type":"null"}],"description":"Whether `cart_url` leads to the cart or the checkout; null when the result screen offers neither."},"provenance":{"type":"object","properties":{"channel":{"anyOf":[{"type":"string","enum":["inline","popup","link","qr"]},{"type":"null"}]},"page":{"description":"The page the tool ran on, without its query string.","type":["string","null"]},"referrer_host":{"type":["string","null"]},"device":{"anyOf":[{"type":"string","enum":["mobile","tablet","desktop"]},{"type":"null"}]},"utm":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"},"description":"The `utm_*` parameters of the visit."},"embed_id":{"description":"`em_…`: the embed the tool ran in.","type":["string","null"]}},"required":["channel","page","referrer_host","device","utm","embed_id"],"description":"Where the visitor came from; each field null when unknown."}},"required":["id","object","submitted_at","workspace","tool","contact","answers","answers_by_key","output","output_by_key","recommended_products","cart_url","cart_mode","provenance"],"title":"LeadV1","description":"One completed visitor session of a tool. New fields may be added at any time: ignore those you do not know. Webhooks set up in Integrations may leave out the sections the merchant unchecked."},"LeadList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Lead"},"description":"Newest first."},"has_more":{"type":"boolean","description":"Whether older leads remain: ask for them with `before` = the last `id`."}},"required":["data","has_more"]},"CreateHookRequest":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2048,"description":"Where each lead is POSTed: https, a public address, no user name or password.","examples":["https://hooks.zapier.com/hooks/standard/123/abc"]},"tool":{"description":"A tool of the workspace (`tl_…`): its leads only. Absent or null: every tool, those created later included.","type":["string","null"]},"app":{"description":"How Integrations names the hook. Default: the app of an OAuth connection, `other` for an API key.","type":"string","enum":["zapier","make","n8n","other"]}},"required":["url"],"additionalProperties":false},"Hook":{"type":"object","properties":{"id":{"type":"string","description":"`dst_…`: what `DELETE /hooks/{id}` takes.","examples":["dst_06d4q7w2e9r1t5y8u3i6o0p4a2"]},"url":{"type":"string"},"tool":{"description":"`tl_…`, or null for every tool.","type":["string","null"]},"app":{"type":"string","enum":["zapier","make","n8n","other"]},"signing_secret":{"type":"string","description":"`whsec_…`: verifies each delivery's `webhook-signature`. Given only in this answer.","examples":["whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD"]}},"required":["id","url","tool","app","signing_secret"]},"LeadCreatedEvent":{"type":"object","properties":{"type":{"type":"string","const":"lead.created"},"timestamp":{"type":"string","format":"date-time","description":"When this attempt was sent, UTC, to the millisecond."},"data":{"$ref":"#/components/schemas/Lead"}},"required":["type","timestamp","data"]}},"responses":{"Unauthorized":{"description":"No valid API key or access token: missing, malformed, unknown, revoked or expired.","headers":{"WWW-Authenticate":{"description":"`Bearer realm=\"magnetly\"`","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"UNAUTHORIZED":{"value":{"code":"UNAUTHORIZED","message":"Missing or invalid API key or access token. Send it as Authorization: Bearer <key or token>."}}}}}},"NotInPlan":{"description":"The workspace's plan does not include lead destinations.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"NOT_IN_PLAN":{"value":{"code":"NOT_IN_PLAN","message":"Lead destinations are not in this workspace's plan."}}}}}},"RateLimited":{"description":"Over a rate limit: wait `Retry-After` seconds.","headers":{"Retry-After":{"description":"Seconds to wait before trying again.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"value":{"code":"RATE_LIMITED","message":"Too many requests. Try again in a minute."}}}}}}},"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"mgk_…","description":"An API key of the workspace, created in Workspace settings > Integrations > Developers."},"oauth2":{"type":"oauth2","description":"For Zapier and Make only: the apps configured by Magnetly sign in to one workspace, with PKCE (S256) and their client secret in the token request. `resource` is the base URL. Access tokens last 1 hour; refresh tokens rotate at each use.","flows":{"authorizationCode":{"authorizationUrl":"https://v2.magnetly.co/api/auth/oauth2/authorize","tokenUrl":"https://v2.magnetly.co/api/auth/oauth2/token","refreshUrl":"https://v2.magnetly.co/api/auth/oauth2/token","scopes":{"offline_access":"A refresh token."}}}}}}}