{"openapi":"3.1.0","info":{"title":"Deepberth API","version":"1.0.0","description":"Create and manage smart links, send events, and read reports from your backend."},"servers":[{"url":"https:\/\/baiocodesolutions.com\/api\/v1"}],"security":[{"bearerAuth":[]}],"paths":{"\/me":{"get":{"operationId":"me","summary":"Check your token","description":"Shows the organization and access of the token used. A good first call.","tags":["account"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":{"organization":{"id":3,"name":"Your Brand"},"token":{"name":"Production backend","prefix":"dbk_a1b2c3d4","scopes":["links:read","links:write"],"app_id":null,"expires_at":null}}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/apps":{"get":{"operationId":"apps.list","summary":"List apps","description":"Returns the apps this token can reach.","tags":["account"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":[{"id":12,"name":"Your Brand App","ios_bundle_id":"com.yourbrand.app","android_package":"com.yourbrand","created_at":"2026-11-01T09:00:00+00:00"}]}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"apps:read"}},"\/apps\/{id}":{"get":{"operationId":"apps.get","summary":"Get an app","description":"Returns one app.","tags":["account"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":{"id":12,"name":"Your Brand App","ios_bundle_id":"com.yourbrand.app","android_package":"com.yourbrand","created_at":"2026-11-01T09:00:00+00:00"}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"apps:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}]}},"\/domains":{"get":{"operationId":"domains.list","summary":"List domains","description":"Returns your custom domains and the shared domains available to you. Only verified domains can be used for links.","tags":["account"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":[{"id":7,"hostname":"link.yourbrand.com","kind":"custom","status":"verified","ssl_status":"active"}]}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"domains:read"}},"\/usage":{"get":{"operationId":"usage.get","summary":"Get usage","description":"Returns approximate monthly active users for the current calendar month in UTC.","tags":["account"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":{"monthly_active_users":12400,"limit":150000,"percent_used":8,"period":"2026-11"}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"usage:read"}},"\/links":{"post":{"operationId":"links.create","summary":"Create a link","description":"Creates a smart link and returns its short_url. It is live immediately.","tags":["links"],"responses":{"201":{"description":"Success","content":{"application\/json":{"example":{"data":{"id":4821,"short_url":"https:\/\/link.yourbrand.com\/summer","app_id":12,"domain_id":7,"slug":"summer","title":"Summer sale","web_url":"https:\/\/yourbrand.com\/summer","ios_url":"https:\/\/apps.apple.com\/app\/id123456789","android_url":"https:\/\/play.google.com\/store\/apps\/details?id=com.yourbrand","deep_link_path":"\/offers\/summer","deep_link_data":{"coupon":"SUN20"},"ios_paste_page":false,"channel":"paid_social","campaign":"summer-2026","ad_group":null,"creative":null,"is_active":true,"expires_at":null,"created_at":"2026-11-08T12:00:00+00:00","updated_at":"2026-11-08T12:00:00+00:00"}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"links:write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"example":{"app_id":12,"domain_id":7,"slug":"summer","title":"Summer sale","web_url":"https:\/\/yourbrand.com\/summer","ios_url":"https:\/\/apps.apple.com\/app\/id123456789","android_url":"https:\/\/play.google.com\/store\/apps\/details?id=com.yourbrand","deep_link_path":"\/offers\/summer","deep_link_data":{"coupon":"SUN20"},"campaign":"summer-2026"}}}}},"get":{"operationId":"links.list","summary":"List links","description":"Returns links, newest first.","tags":["links"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":[{"id":4821,"short_url":"https:\/\/link.yourbrand.com\/summer","app_id":12,"domain_id":7,"slug":"summer","title":"Summer sale","web_url":"https:\/\/yourbrand.com\/summer","ios_url":"https:\/\/apps.apple.com\/app\/id123456789","android_url":"https:\/\/play.google.com\/store\/apps\/details?id=com.yourbrand","deep_link_path":"\/offers\/summer","deep_link_data":{"coupon":"SUN20"},"ios_paste_page":false,"channel":"paid_social","campaign":"summer-2026","ad_group":null,"creative":null,"is_active":true,"expires_at":null,"created_at":"2026-11-08T12:00:00+00:00","updated_at":"2026-11-08T12:00:00+00:00"}],"next_cursor":"eyJpZCI6NDgyMX0","has_more":true}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"links:read","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"app_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"domain_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"campaign","in":"query","required":false,"schema":{"type":"string"}},{"name":"is_active","in":"query","required":false,"schema":{"type":"boolean"}}]}},"\/links\/batch":{"post":{"operationId":"links.batch","summary":"Create many links","description":"Creates up to 100 links. Each item succeeds or fails independently, so check every result.","tags":["links"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":[{"index":0,"status":"created","data":{"id":4822,"short_url":"https:\/\/link.yourbrand.com\/x7Kp2mQa"}},{"index":1,"status":"failed","error":{"code":"validation_failed","details":{"web_url":["The web url field must be a valid URL."]}}}]}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"links:write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"example":{"links":[{"app_id":12,"domain_id":7,"web_url":"https:\/\/yourbrand.com\/a"},{"app_id":12,"domain_id":7,"web_url":"not-a-url"}]}}}}}},"\/links\/{id}":{"get":{"operationId":"links.get","summary":"Get a link","description":"Returns one link.","tags":["links"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":{"id":4821,"short_url":"https:\/\/link.yourbrand.com\/summer","app_id":12,"domain_id":7,"slug":"summer","title":"Summer sale","web_url":"https:\/\/yourbrand.com\/summer","ios_url":"https:\/\/apps.apple.com\/app\/id123456789","android_url":"https:\/\/play.google.com\/store\/apps\/details?id=com.yourbrand","deep_link_path":"\/offers\/summer","deep_link_data":{"coupon":"SUN20"},"ios_paste_page":false,"channel":"paid_social","campaign":"summer-2026","ad_group":null,"creative":null,"is_active":true,"expires_at":null,"created_at":"2026-11-08T12:00:00+00:00","updated_at":"2026-11-08T12:00:00+00:00"}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"links:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}]},"patch":{"operationId":"links.update","summary":"Update a link","description":"Changes take effect immediately and the address stays the same. app_id, domain_id and slug cannot be changed.","tags":["links"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":{"web_url":"https:\/\/yourbrand.com\/winter","id":4821,"short_url":"https:\/\/link.yourbrand.com\/summer","app_id":12,"domain_id":7,"slug":"summer","title":"Summer sale","ios_url":"https:\/\/apps.apple.com\/app\/id123456789","android_url":"https:\/\/play.google.com\/store\/apps\/details?id=com.yourbrand","deep_link_path":"\/offers\/summer","deep_link_data":{"coupon":"SUN20"},"ios_paste_page":false,"channel":"paid_social","campaign":"summer-2026","ad_group":null,"creative":null,"is_active":true,"expires_at":null,"created_at":"2026-11-08T12:00:00+00:00","updated_at":"2026-11-08T12:00:00+00:00"}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"links:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application\/json":{"example":{"web_url":"https:\/\/yourbrand.com\/winter","is_active":true}}}}},"delete":{"operationId":"links.delete","summary":"Delete a link","description":"The link stops working immediately. Its slug can never be reused on that domain.","tags":["links"],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"links:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}]}},"\/links\/{id}\/stats":{"get":{"operationId":"links.stats","summary":"Get link statistics","description":"Returns clicks and installs for one link. Available on plans with API data access.","tags":["reports"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":{"days":30,"clicks":1840,"bot_clicks":22,"installs":312,"platforms":[{"platform":"ios","clicks":1020},{"platform":"android","clicks":820}]}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"reports:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer"}}]}},"\/reports":{"get":{"operationId":"reports.get","summary":"Get a report","description":"Returns totals, daily figures, platforms, links, campaigns, events and delivery results.","tags":["reports"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":{"totals":{"people":18400,"bots":210,"installs":3120,"attributed":2710},"days":[{"date":"2026-11-08","label":"Nov 8","people":640,"bots":8,"installs":104}],"platforms":[{"label":"ios","value":10200}],"matches":[{"label":"install_referrer","value":1400}],"links":[{"url":"link.yourbrand.com\/summer","title":"Summer sale","deleted":false,"people":1840,"installs":312}],"campaigns":[{"name":"summer-2026","people":1840,"installs":312}],"events":[{"name":"purchase","total":420,"revenue":8390.5}],"deliveries":[{"label":"delivered","value":980}]}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"reports:read","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer"}},{"name":"app_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}]}},"\/events":{"post":{"operationId":"events.create","summary":"Send events","description":"Records up to 50 events for a device and sends them to your webhooks and postbacks.","tags":["events"],"responses":{"202":{"description":"Success","content":{"application\/json":{"example":{"data":{"accepted":1,"duplicates":0}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"events:write","requestBody":{"required":true,"content":{"application\/json":{"example":{"app_id":12,"device_id":"6f2b9a52-3c84-4b1e-9f10-2a7c1d4e8b90","platform":"ios","events":[{"event_id":"0c7f3a10-8d2e-4f6b-b1a4-93e5c2d7f810","name":"purchase","revenue":19.99,"currency":"USD","properties":{"sku":"A-100"}}]}}}}}},"\/reports\/cohorts":{"get":{"operationId":"reports.cohorts","summary":"Get cohorts","description":"Returns devices, events and USD revenue by install day and days since install. Available on plans with the cohort API.","tags":["reports"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":[{"install_date":"2026-11-01","day":3,"event_name":"purchase","devices":118,"event_count":143,"revenue_usd":2841.5}]}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"reports:read","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer"}},{"name":"app_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"event","in":"query","required":false,"schema":{"type":"string"}}]}},"\/devices\/{id}":{"delete":{"operationId":"devices.delete","summary":"Erase a device","description":"Deletes a device and its install and event records, so you can honor an end user\u2019s erasure request.","tags":["events"],"responses":{"202":{"description":"Success","content":{"application\/json":{"example":{"data":{"status":"erasure_scheduled"}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"devices:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"app_id","in":"query","required":false,"schema":{"type":"integer"}}]}},"\/webhooks":{"get":{"operationId":"webhooks.list","summary":"List webhooks","description":"Returns your webhook endpoints. Signing secrets are not included.","tags":["webhooks"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":[{"id":31,"app_id":12,"url":"https:\/\/api.yourbrand.com\/hooks\/deepberth","events":["install","purchase"],"is_enabled":true,"created_at":"2026-11-08T12:00:00+00:00"}]}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"webhooks:read"},"post":{"operationId":"webhooks.create","summary":"Create a webhook","description":"Registers a public https address. signing_secret appears only in this response.","tags":["webhooks"],"responses":{"201":{"description":"Success","content":{"application\/json":{"example":{"data":{"id":31,"app_id":12,"url":"https:\/\/api.yourbrand.com\/hooks\/deepberth","events":["install","purchase"],"is_enabled":true,"created_at":"2026-11-08T12:00:00+00:00","signing_secret":"whsec_..."}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"webhooks:write","requestBody":{"required":true,"content":{"application\/json":{"example":{"app_id":12,"url":"https:\/\/api.yourbrand.com\/hooks\/deepberth","events":["install","purchase"]}}}}}},"\/webhooks\/{id}":{"patch":{"operationId":"webhooks.update","summary":"Update a webhook","description":"Changes the address, events or enabled state.","tags":["webhooks"],"responses":{"200":{"description":"Success","content":{"application\/json":{"example":{"data":{"is_enabled":false,"id":31,"app_id":12,"url":"https:\/\/api.yourbrand.com\/hooks\/deepberth","events":["install","purchase"],"created_at":"2026-11-08T12:00:00+00:00"}}}}},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"webhooks:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application\/json":{"example":{"is_enabled":false}}}}},"delete":{"operationId":"webhooks.delete","summary":"Delete a webhook","description":"Stops deliveries to this endpoint.","tags":["webhooks"],"responses":{"204":{"description":"Success"},"default":{"description":"Error","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}},"x-required-scope":"webhooks:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}]}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"dbk_..."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object"},"request_id":{"type":"string"}}}}}}}}