{"openapi":"3.1.0","info":{"title":"Lana Network API","version":"1.0.0","summary":"Read your stats, sites, deals and payments; report conversions by postback.","description":"Bearer-key REST API (60 calls per key per minute) and the server-to-server conversion postback. Dates are UTC days, money is USD. Human guide: https://lananetwork.com/developers"},"servers":[{"url":"https://app.lananetwork.com/api/v1"}],"tags":[{"name":"Account"},{"name":"Reporting"},{"name":"Deals and payments"},{"name":"Postback"}],"security":[{"bearerKey":[]}],"paths":{"/me":{"get":{"operationId":"whoami","tags":["Account"],"summary":"The key in use","description":"Owner, rights and calls used this minute.","responses":{"200":{"description":"The identity of the key: key_id, name, key_prefix, owner_kind, owner_id, can_write, scope (read | write), expires_at, calls_this_minute, limit_per_minute.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"}}}},"/stats":{"get":{"operationId":"stats","tags":["Reporting"],"summary":"Statistics per UTC day and zone","description":"Impressions, clicks and valid clicks per UTC day and zone. Advertiser keys also get leads, purchases, payers and cost; publisher keys get earnings. Default: the last 7 days. Ranges are capped per call: 7 days for publisher and advertiser keys (31 for admin keys).","parameters":[{"name":"from","in":"query","required":false,"description":"First UTC day, YYYY-MM-DD (default: 6 days before `to`)","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Last UTC day, YYYY-MM-DD (default: today UTC)","schema":{"type":"string","format":"date"}},{"name":"group_by","in":"query","required":false,"description":"Publisher keys only. Break the report down by up to 3 of day, hour, site, zone, format, country, device, sub1, sub2, sub3, browser, os (REST: group_by=day,zone). Rows then carry the requested keys plus impressions, clicks, valid_clicks, ctr, revenue_usd, ecpm_usd and, unless country, device, a sub ID, browser or os is asked, decisions, fills, fill_rate. For each sub ID the 200 values with the most impressions are named and the rest is summed as (other). Up to 92 days, 5000 rows. [] = one total row. Without it: the per day and zone report.","schema":{"type":"array","items":{"type":"string","enum":["day","hour","site","zone","format","country","device","sub1","sub2","sub3","browser","os"]},"maxItems":3}}],"responses":{"200":{"description":"JSON answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"}}}},"/sites":{"get":{"operationId":"sites","tags":["Reporting"],"summary":"Sites","description":"The sites visible to the key.","responses":{"200":{"description":"JSON answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"}}}},"/zones":{"get":{"operationId":"zones","tags":["Reporting"],"summary":"Zones","description":"The zones visible to the key, with their public key.","responses":{"200":{"description":"JSON answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"}}}},"/campaigns":{"get":{"operationId":"campaigns","tags":["Campaigns"],"summary":"Campaigns and their targeting","description":"Advertiser keys list their own campaigns, admin keys all of them. Each campaign carries its full targeting: countries, devices, os, langs, browsers (chrome, firefox, safari, other; [] = all), schedule ({ tz, hours } with hours[0..6] = Monday to Sunday, each a list of local hours 0 to 23; null = always), freqCap ({ perVisitor, hours } or null) and zones ({ allow, block } of public zone keys; block wins). Read only: targeting is edited in the dashboard. Publisher keys get 403.","responses":{"200":{"description":"JSON answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"}}}},"/deals":{"get":{"operationId":"deals","tags":["Deals and payments"],"summary":"Deals","description":"Deals visible to the key. Publisher keys also get the prepaid schedule: paid_through, next_due_date, expected_amount_usd and payment_status.","parameters":[{"name":"include_ended","in":"query","required":false,"description":"Also list ended deals (default false: running and scheduled only)","schema":{"type":"boolean"}}],"responses":{"200":{"description":"JSON answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"}}}},"/payments":{"get":{"operationId":"payments","tags":["Deals and payments"],"summary":"Prepaid payments, newest first","description":"Publisher keys see their own payments, admin keys all of them. Advertiser keys get 403.","parameters":[{"name":"deal_id","in":"query","required":false,"description":"Only this deal's payments","schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","required":false,"description":"Max rows (default 100)","schema":{"type":"integer","minimum":1,"maximum":500}}],"responses":{"200":{"description":"JSON answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"}}}},"/v1/postback":{"get":{"operationId":"postback","tags":["Postback"],"summary":"Report a conversion","description":"One GET request per conversion, from your server or your tracker. The click_id is the value we sent in the ocid parameter of your landing URL. Answers are plain text, never a redirect, never cached. A lead or purchase counts once per click.","servers":[{"url":"https://postback.lananetwork.com","description":"Postback host"}],"security":[{"postbackToken":[]}],"parameters":[{"name":"token","in":"query","required":true,"description":"Your secret postback token (generate or regenerate it on the Postback page of the advertiser dashboard).","schema":{"type":"string","maxLength":256}},{"name":"click_id","in":"query","required":true,"description":"The ocid value of the click (35 characters).","schema":{"type":"string","pattern":"^[0-9A-Za-z]{35}$"}},{"name":"event","in":"query","required":true,"description":"lead, purchase, or purchase_recurring (each rebill).","schema":{"type":"string","enum":["lead","purchase","purchase_recurring"]}},{"name":"payout","in":"query","required":false,"description":"Amount in USD, dot as decimal separator.","schema":{"type":"string","pattern":"^\\d{1,9}(\\.\\d{1,6})?$"}},{"name":"tx","in":"query","required":false,"description":"Your transaction id (1 to 64 of A-Z a-z 0-9 . _ -). With it, each rebill is unique per click and tx.","schema":{"type":"string","pattern":"^[A-Za-z0-9._-]{1,64}$"}}],"responses":{"200":{"description":"Body OK (recorded), OK: duplicate, ERROR: unknown click_id or ERROR: click expired (do not retry the last two).","content":{"text/plain":{"schema":{"type":"string","examples":["OK"]}}}},"400":{"description":"ERROR: bad request. A parameter is missing or malformed.","content":{"text/plain":{"schema":{"type":"string"}}}},"401":{"description":"ERROR: bad token.","content":{"text/plain":{"schema":{"type":"string"}}}},"503":{"description":"ERROR: retry. Temporary problem on our side.","content":{"text/plain":{"schema":{"type":"string"}}}}}}}},"components":{"securitySchemes":{"bearerKey":{"type":"http","scheme":"bearer","description":"API key (lnk_...). Read-only keys can be created from your account page; write keys are issued by the network on request. Shown once, revocable."},"postbackToken":{"type":"apiKey","in":"query","name":"token","description":"Your secret postback token."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","examples":["invalid_api_key"]},"message":{"type":"string"}}}}}},"responses":{"BadRequest":{"description":"invalid_request, invalid_json, invalid_range or range_too_long: bad input (unknown field, bad date, range over the cap).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"invalid_api_key or api_key_expired: the key is missing, malformed, unknown, revoked or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"forbidden: the owner of the key cannot use this endpoint; scope: the key is read-only (read-only keys can be created from your account page, write keys are issued by the network on request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Conflict":{"description":"status_changed, status_not_allowed or duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unprocessable":{"description":"Refused by the database rules (for example payment_period_overlap, zone_archived).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"rate_limited: over 60 calls per minute per key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"Internal":{"description":"internal_error: retry in a minute.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}