{"openapi":"3.1.0","info":{"title":"Linekit API","version":"1.0.0","description":"Developer-first communications infrastructure API for phone numbers, WhatsApp, and messaging channels."},"servers":[{"url":"https://api.linekit.dev/v1","description":"Production API"}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"Project-scoped Linekit API key (lk_test_... or lk_live_...)"}}},"security":[{"BearerAuth":[]}],"paths":{"/projects":{"get":{"summary":"List projects","tags":["Projects"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create project","tags":["Projects"],"responses":{"201":{"description":"Created"}}}},"/projects/{id}":{"get":{"summary":"Get project","tags":["Projects"],"responses":{"200":{"description":"OK"}}},"patch":{"summary":"Update project","tags":["Projects"],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete project","tags":["Projects"],"responses":{"200":{"description":"Deleted"}}}},"/numbers/available":{"get":{"summary":"Search available phone numbers with server-signed quotes","tags":["Numbers"],"responses":{"200":{"description":"OK"}}}},"/numbers/reservations":{"get":{"summary":"List active 30-minute number reservations","tags":["Numbers"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Reserve available phone numbers using quote tokens","tags":["Numbers"],"responses":{"201":{"description":"Reserved"}}}},"/numbers/reservations/{id}/extend":{"post":{"summary":"Extend a number reservation by 30 minutes","tags":["Numbers"],"responses":{"200":{"description":"Extended"}}}},"/numbers/reservations/{id}":{"delete":{"summary":"Release a held number reservation","tags":["Numbers"],"responses":{"200":{"description":"Released"}}}},"/numbers":{"get":{"summary":"List phone numbers","tags":["Numbers"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Purchase and provision a phone number (charged to credit balance)","tags":["Numbers"],"responses":{"201":{"description":"Provisioned"},"402":{"description":"Insufficient credit balance"}}}},"/numbers/byon/start":{"post":{"summary":"Start OTP verification to link an existing phone number (BYON) for WhatsApp or Telegram","tags":["Numbers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["phone_number"],"properties":{"phone_number":{"type":"string","example":"+14155550100"},"country":{"type":"string","example":"US"}}}}}},"responses":{"201":{"description":"Verification OTP sent"},"400":{"description":"Number cannot be linked"},"409":{"description":"Number already active in project"},"429":{"description":"Too many verification requests"}}}},"/numbers/byon/verify":{"post":{"summary":"Verify OTP and activate a Bring Your Own Number (BYON) in the project","tags":["Numbers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["verification_id","code"],"properties":{"verification_id":{"type":"string","example":"byon_..."},"code":{"type":"string","example":"482910"}}}}}},"responses":{"201":{"description":"BYON number verified and activated"},"400":{"description":"Invalid or expired verification code"}}}},"/numbers/{id}":{"get":{"summary":"Get phone number","tags":["Numbers"],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Release phone number","tags":["Numbers"],"responses":{"200":{"description":"Released"}}}},"/numbers/{id}/voice":{"patch":{"summary":"Update voice settings on a phone number","tags":["Numbers"],"responses":{"200":{"description":"Updated"}}}},"/numbers/{id}/channels":{"get":{"summary":"List messaging channels configured on a phone number","tags":["Numbers","Connections"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Link WhatsApp or Telegram to a phone number","tags":["Numbers","Connections"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["channel"],"properties":{"channel":{"type":"string","enum":["whatsapp","telegram"]},"name":{"type":"string"},"mode":{"type":"string","enum":["web_session","cloud_api","bot_api"]},"credentials":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"responses":{"201":{"description":"Linked"},"409":{"description":"Channel already linked"}}}},"/numbers/{id}/channels/{channel}":{"delete":{"summary":"Disconnect and unlink a channel from a phone number","tags":["Numbers","Connections"],"responses":{"200":{"description":"Unlinked"}}}},"/numbers/{id}/messages":{"post":{"summary":"Send a message from a specific phone number across one or all configured channels","tags":["Numbers","Messaging"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["channel","to","type"],"properties":{"channel":{"type":"string","enum":["all","sms","whatsapp","telegram"]},"to":{"type":"string","example":"+14155550199"},"type":{"type":"string","enum":["text","image","video","audio","document","template"]},"text":{"type":"string","description":"Message text body (required when type is 'text')"},"preview_url":{"type":"boolean"},"media":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"media_id":{"type":"string"},"caption":{"type":"string"},"filename":{"type":"string"}}},"template":{"type":"object","properties":{"name":{"type":"string"},"language":{"type":"string"},"components":{"type":"array","items":{"type":"object"}}}},"metadata":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"responses":{"200":{"description":"Idempotent replay"},"201":{"description":"Delivered in sandbox mode"},"202":{"description":"Accepted and queued for delivery"},"400":{"description":"Validation or channel capability error"},"404":{"description":"Sender phone number not found"},"409":{"description":"Channel session is not ready"}}}},"/calls":{"get":{"summary":"List voice calls","tags":["Voice"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Initiate an outbound voice call","tags":["Voice"],"responses":{"201":{"description":"Initiated"}}}},"/calls/{id}":{"get":{"summary":"Get voice call details","tags":["Voice"],"responses":{"200":{"description":"OK"}}}},"/calls/{id}/answer":{"post":{"summary":"Answer an active inbound voice call","tags":["Voice"],"responses":{"200":{"description":"Answered"}}}},"/calls/{id}/speak":{"post":{"summary":"Speak text or SSML on an active voice call","tags":["Voice"],"responses":{"200":{"description":"Speaking"}}}},"/calls/{id}/hangup":{"post":{"summary":"Hang up an active voice call","tags":["Voice"],"responses":{"200":{"description":"Ended"}}}},"/esims/pricing":{"get":{"summary":"Get programmable eSIM pricing and organization credit balance","tags":["eSIMs"],"responses":{"200":{"description":"OK"}}}},"/esims":{"get":{"summary":"List programmable eSIM profiles","tags":["eSIMs"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Purchase and provision programmable eSIM profiles (charged to credit balance)","tags":["eSIMs"],"responses":{"201":{"description":"Provisioned"},"402":{"description":"Insufficient credit balance"}}}},"/esims/{id}":{"get":{"summary":"Get eSIM profile details and LPA activation code","tags":["eSIMs"],"responses":{"200":{"description":"OK"}}},"patch":{"summary":"Enable, disable, standby, or update data cap on an eSIM","tags":["eSIMs"],"responses":{"200":{"description":"Updated"}}}},"/esims/{id}/profile":{"get":{"summary":"Download .mobileconfig or .lpa.txt eSIM installation profile","tags":["eSIMs"],"responses":{"200":{"description":"Profile file"}}}},"/connections":{"get":{"summary":"List channel connections","tags":["Connections"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create a channel connection","tags":["Connections"],"responses":{"201":{"description":"Created"}}}},"/connections/{id}":{"get":{"summary":"Get channel connection","tags":["Connections"],"responses":{"200":{"description":"OK"}}},"patch":{"summary":"Update channel connection","tags":["Connections"],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete channel connection","tags":["Connections"],"responses":{"200":{"description":"Deleted"}}}},"/connections/{id}/connect":{"post":{"summary":"Connect a channel connection","tags":["Connections"],"responses":{"200":{"description":"OK"}}}},"/connections/{id}/pairing-code":{"post":{"summary":"Request a WhatsApp Web phone pairing code","tags":["Connections"],"responses":{"200":{"description":"OK"}}}},"/connections/{id}/disconnect":{"post":{"summary":"Disconnect a channel connection","tags":["Connections"],"responses":{"200":{"description":"OK"}}}},"/connections/{id}/status":{"get":{"summary":"Get connection status","tags":["Connections"],"responses":{"200":{"description":"OK"}}}},"/messages":{"get":{"summary":"List messages","tags":["Messaging"],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Send a message","tags":["Messaging"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["from","channel","to","type"],"properties":{"from":{"type":"string","description":"Owned phone number (ID or E.164) or email sender identifier (SMS requires a Linekit-provisioned number)","example":"+14155550100"},"channel":{"type":"string","enum":["all","sms","whatsapp","telegram","email"]},"to":{"type":"string","example":"+14155550199"},"type":{"type":"string","enum":["text","image","video","audio","document","template"]},"text":{"type":"string","description":"Message text body (required when type is 'text')"},"preview_url":{"type":"boolean"},"media":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"media_id":{"type":"string"},"caption":{"type":"string"},"filename":{"type":"string"}}},"template":{"type":"object","properties":{"name":{"type":"string"},"language":{"type":"string"},"components":{"type":"array","items":{"type":"object"}}}},"metadata":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"responses":{"200":{"description":"Idempotent replay"},"201":{"description":"Delivered in sandbox mode"},"202":{"description":"Accepted and queued for delivery"},"400":{"description":"Validation or channel capability error"},"404":{"description":"Sender number or channel not found"},"409":{"description":"Channel session is not ready"}}}},"/messages/{id}":{"get":{"summary":"Get message","tags":["Messaging"],"responses":{"200":{"description":"OK"}}}},"/media/{mediaId}":{"get":{"summary":"Download a mirrored inbound media asset","tags":["Messaging"],"responses":{"200":{"description":"Binary media stream"},"404":{"description":"Not found"}}}},"/webhook":{"get":{"summary":"Get the active project webhook configuration","tags":["Webhooks"],"responses":{"200":{"description":"OK"},"404":{"description":"Not configured"}}},"put":{"summary":"Create or update the project webhook endpoint (1 per environment)","tags":["Webhooks"],"responses":{"200":{"description":"Updated"},"201":{"description":"Created"}}},"delete":{"summary":"Delete the project webhook endpoint","tags":["Webhooks"],"responses":{"200":{"description":"Deleted"}}}},"/webhook/rotate-secret":{"post":{"summary":"Rotate the project webhook signing secret","tags":["Webhooks"],"responses":{"200":{"description":"Rotated"}}}},"/webhook/test":{"post":{"summary":"Send a signed test event to the project webhook endpoint","tags":["Webhooks"],"responses":{"200":{"description":"Queued"},"404":{"description":"Not configured"}}}},"/webhook/deliveries":{"get":{"summary":"List recent delivery attempts for the project webhook endpoint","tags":["Webhooks"],"responses":{"200":{"description":"OK"},"404":{"description":"Not configured"}}}},"/webhook/replay":{"post":{"summary":"Replay a historical webhook event to the project webhook endpoint","tags":["Webhooks"],"responses":{"200":{"description":"Replayed"},"404":{"description":"Not found"}}}},"/usage":{"get":{"summary":"Get usage summary","tags":["Usage"],"responses":{"200":{"description":"OK"}}}},"/billing":{"get":{"summary":"Get credit balance and subscriptions","tags":["Billing"],"responses":{"200":{"description":"OK"}}}},"/billing/ledger":{"get":{"summary":"List organization credit balance ledger entries","tags":["Billing"],"responses":{"200":{"description":"OK"}}}},"/billing/invoices":{"get":{"summary":"List invoices","tags":["Billing"],"responses":{"200":{"description":"OK"}}}}}}