Login
Exchange email and password for an API key to authenticate all subsequent Supasend API requests.
curl -X POST "https://api.supasend.io/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "you@example.com",
"password": "supersecret"
}'
import requests
import json
url = "https://api.supasend.io/api/v1/auth/login"
headers = {
"Content-Type": "application/json"
}
data = {
"email": "you@example.com",
"password": "supersecret"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.supasend.io/api/v1/auth/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"email": "you@example.com",
"password": "supersecret"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"email": "you@example.com",
"password": "supersecret"
}`)
req, err := http.NewRequest("POST", "https://api.supasend.io/api/v1/auth/login", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.supasend.io/api/v1/auth/login')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request.body = '{
"email": "you@example.com",
"password": "supersecret"
}'
response = http.request(request)
puts response.body
{
"user": {
"id": "example_string",
"email": "user@example.com",
"name": "John Doe"
},
"token": "sk_live_a1b2c3d4e5f6..."
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Internal Server Error",
"message": "An unexpected error occurred on the server",
"code": 500,
"requestId": "req_1234567890"
}
POST
/api/v1/auth/login
POST
Base URLstring
Target server for requests. Edit to use your own host.
Content-Typestring
RequiredThe media type of the request body
Options: application/json
emailstring
RequiredFormat: email
Request Preview
Response
Response will appear here after sending the request
Body
application/json
emailstring
RequiredExample:
you@example.compasswordstring
RequiredExample:
supersecretResponses
userobject
tokenstring
API key — pass in the X-API-Key header for all other endpoints. Shown once.
Login
Exchanges credentials for a fresh API key.
Was this page helpful?