{"openapi":"3.1.0","info":{"title":"ReliaRing Public API","version":"1.0.0","description":"The ReliaRing Public API lets you programmatically manage your VoIP account resources.\n\n## Authentication\n\nAll requests require an API key passed as a Bearer token:\n\n```\nAuthorization: Bearer rk_live_your_key_here\n```\n\nOr via the X-API-Key header:\n\n```\nX-API-Key: rk_live_your_key_here\n```\n\n### Test Mode\n\nTest keys (`rk_test_`) execute read operations normally and return `livemode: false`.\nMutations with test keys return `dry_run: true` without executing.\n\n## Rate Limiting\n\nDefault: 1,000 requests per hour per key. Both the request allowance and the\nwindow length are configurable per key.\n\nRate limit headers (IETF draft-6) are included in every response:\n- `RateLimit-Limit` — requests allowed per window\n- `RateLimit-Remaining` — requests remaining in the current window\n- `RateLimit-Reset` — seconds until the current window resets\n- `RateLimit-Policy` — the policy, as `{limit};w={window_seconds}`\n\nA rate-limited request answers `429` and adds `Retry-After`, in seconds.\n\n## Pagination\n\nList endpoints accept `?page=1&limit=20` (max 100).\nResponses include `has_more` and `next_page_url` for easy traversal.\n\n## Errors\n\nAll errors follow a consistent format:\n```json\n{\n  \"status\": 404,\n  \"code\": \"not_found\",\n  \"message\": \"Phone number not found.\"\n}\n```","contact":{"name":"ReliaRing Developer Support","email":"help@reliaring.com","url":"https://docs.reliaring.com"}},"servers":[{"url":"https://ca.api.reliaring.com/api/v1","description":"Production"},{"url":"http://localhost:5050/api/v1","description":"Development"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","description":"API key in rk_live_... or rk_test_... format."}},"schemas":{"Error":{"type":"object","required":["status","code","message"],"properties":{"status":{"type":"integer","example":404},"code":{"type":"string","example":"not_found"},"message":{"type":"string","example":"Resource not found."},"param":{"type":"string","description":"The field that caused the error."}}},"ListEnvelope":{"type":"object","required":["object","data","has_more","total_count","page","page_size"],"properties":{"object":{"type":"string","enum":["list"]},"data":{"type":"array","items":{}},"has_more":{"type":"boolean"},"total_count":{"type":"integer"},"page":{"type":"integer"},"page_size":{"type":"integer"},"next_page_url":{"type":"string","nullable":true}}},"PhoneNumber":{"type":"object","required":["object","id","livemode","phone_number","type","status","capabilities","country_code","created_at"],"properties":{"object":{"type":"string","enum":["phone_number"]},"id":{"type":"string","example":"clxyz123abc"},"livemode":{"type":"boolean"},"phone_number":{"type":"string","example":"+16045551234"},"friendly_name":{"type":"string","example":"+1 (604) 555-1234"},"type":{"type":"string","enum":["local","toll_free","international"]},"status":{"type":"string","enum":["active","porting","suspended","reserved"]},"capabilities":{"type":"object","properties":{"voice":{"type":"boolean"},"sms":{"type":"boolean"},"mms":{"type":"boolean"},"fax":{"type":"boolean"}}},"country_code":{"type":"string","example":"CA"},"assigned_to_user_id":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}}},"Message":{"type":"object","required":["object","id","livemode","phone_number_id","from","to","direction","status","created_at"],"properties":{"object":{"type":"string","enum":["message"]},"id":{"type":"string"},"livemode":{"type":"boolean"},"phone_number_id":{"type":"string"},"from":{"type":"string","example":"+16045551234"},"to":{"type":"string","example":"+17785559876"},"direction":{"type":"string","enum":["inbound","outbound"]},"status":{"type":"string","enum":["pending","sent","delivered","read","failed"]},"num_segments":{"type":"integer"},"has_media":{"type":"boolean"},"media_count":{"type":"integer"},"price":{"type":"string","nullable":true,"example":"-0.0075"},"price_unit":{"type":"string","example":"USD"},"error_message":{"type":"string","nullable":true},"sent_at":{"type":"string","format":"date-time","nullable":true},"delivered_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"Call":{"type":"object","required":["object","id","livemode","call_id","from","to","direction","status","duration","start_time","created_at"],"properties":{"object":{"type":"string","enum":["call"]},"id":{"type":"string"},"livemode":{"type":"boolean"},"call_id":{"type":"string"},"from":{"type":"string","example":"+16045551234"},"from_display_name":{"type":"string","nullable":true},"to":{"type":"string","example":"+17785559876"},"to_display_name":{"type":"string","nullable":true},"direction":{"type":"string","enum":["inbound","outbound","internal"]},"status":{"type":"string","enum":["ringing","answered","busy","no_answer","failed","cancelled","completed"]},"duration":{"type":"integer","description":"Duration in seconds"},"price":{"type":"string","example":"-0.0130"},"price_unit":{"type":"string","example":"USD"},"start_time":{"type":"string","format":"date-time"},"end_time":{"type":"string","format":"date-time","nullable":true},"is_recorded":{"type":"boolean"},"is_emergency_call":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}}},"Account":{"type":"object","required":["object","id","livemode","friendly_name","status","currency","created_at"],"properties":{"object":{"type":"string","enum":["account"]},"id":{"type":"string"},"livemode":{"type":"boolean"},"friendly_name":{"type":"string"},"status":{"type":"string","enum":["active","suspended","cancelled"]},"country":{"type":"string","example":"CA"},"currency":{"type":"string","example":"CAD"},"timezone":{"type":"string","example":"America/Toronto"},"sip_domain":{"type":"string","nullable":true},"current_balance":{"type":"string","description":"Decimal string in account currency"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}}},"SendMessageRequest":{"type":"object","required":["to","from","body","phone_number_id"],"properties":{"to":{"type":"string","pattern":"^\\+[1-9]\\d{1,14}$","example":"+16045559876"},"from":{"type":"string","pattern":"^\\+[1-9]\\d{1,14}$","example":"+16045551234"},"body":{"type":"string","maxLength":1600,"example":"Hello from ReliaRing!"},"phone_number_id":{"type":"string","description":"ID of your phone number to send from"},"media_urls":{"type":"array","items":{"type":"string","format":"uri"},"maxItems":10}}},"UpdateAccountRequest":{"type":"object","properties":{"timezone":{"type":"string","example":"America/Vancouver"},"organization_name":{"type":"string","example":"My Company Inc."}}}}},"tags":[{"name":"Phone Numbers","description":"Manage your phone numbers"},{"name":"Messages","description":"Send and retrieve SMS/MMS messages"},{"name":"Calls","description":"Retrieve call detail records"},{"name":"Account","description":"Manage your account"}],"paths":{"/phone-numbers":{"get":{"operationId":"listPhoneNumbers","summary":"List phone numbers","tags":["Phone Numbers"],"parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":100}},{"name":"status","in":"query","schema":{"type":"string","enum":["active","porting","suspended","reserved"]}},{"name":"type","in":"query","schema":{"type":"string","enum":["local","toll_free","international"]}},{"name":"country_code","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"List of phone numbers","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ListEnvelope"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PhoneNumber"}}}}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/phone-numbers/{id}":{"get":{"operationId":"getPhoneNumber","summary":"Retrieve a phone number","tags":["Phone Numbers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Phone number object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneNumber"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/messages":{"get":{"operationId":"listMessages","summary":"List messages","tags":["Messages"],"parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":100}},{"name":"phone_number_id","in":"query","schema":{"type":"string"}},{"name":"direction","in":"query","schema":{"type":"string","enum":["inbound","outbound"]}},{"name":"status","in":"query","schema":{"type":"string","enum":["pending","sent","delivered","read","failed"]}},{"name":"from","in":"query","schema":{"type":"string"}},{"name":"to","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"List of messages","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ListEnvelope"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}}}}]}}}}}},"post":{"operationId":"sendMessage","summary":"Send an SMS message","tags":["Messages"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageRequest"}}}},"responses":{"201":{"description":"Message created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Phone number not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/messages/{id}":{"get":{"operationId":"getMessage","summary":"Retrieve a message","tags":["Messages"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Message object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/calls":{"get":{"operationId":"listCalls","summary":"List call records","tags":["Calls"],"parameters":[{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":100}},{"name":"direction","in":"query","schema":{"type":"string","enum":["inbound","outbound","internal"]}},{"name":"status","in":"query","schema":{"type":"string","enum":["ringing","answered","busy","no_answer","failed","cancelled","completed"]}},{"name":"from","in":"query","schema":{"type":"string"}},{"name":"to","in":"query","schema":{"type":"string"}},{"name":"created_after","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"created_before","in":"query","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"List of call records","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ListEnvelope"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Call"}}}}]}}}}}}},"/calls/{id}":{"get":{"operationId":"getCall","summary":"Retrieve a call record","tags":["Calls"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Call record object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Call"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/account":{"get":{"operationId":"getAccount","summary":"Retrieve your account","tags":["Account"],"responses":{"200":{"description":"Account object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}}}},"patch":{"operationId":"updateAccount","summary":"Update account settings","tags":["Account"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccountRequest"}}}},"responses":{"200":{"description":"Updated account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}