Before you start
- You need to have Python installed on your machine.
- You need to have a Rewrite API key with the permissions.
Set up REWRITE_API_KEY environment variable
Set up your Rewrite API key in your environment variables.
.env
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Learn how to use the Python SDK to send SMS with the API.
REWRITE_API_KEY=rw...
import os
import rewrite
rewrite.api_key = os.environ["REWRITE_API_KEY"]
def send_sms(to: str):
params: rewrite.Messages.SendOptions = {
"to": to,
"content": "Your OTP code is 478201",
}
return rewrite.messages.send(params)
if __name__ == "__main__":
message = send_sms("+1234567890")
print(message)