ZapSMTP / Docs / API keys & SMTP credentialsResponse
Create SMTP credentials
POST/v1/smtp-credentials
Create an SMTP credential; the password is returned only once.
Requires a full-access live key; test keys get 403 test_key_restricted.
Password: 40 base62 characters. Credentials are sending-only (always behave like sending_access, live mode) and cannot call the HTTP API.
Body parameters
namestringrequired- Limits: trimmed, 1-100 characters → 422 invalid_parameter "name is required (max 100 chars)"
domain_idstring- Restrict the credential to one of the account's domains. Limits: 422 invalid_parameter "unknown domain_id"
Errors
plan_limit_reachedHTTP 403- the <Plan> plan includes <n> SMTP credentials; upgrade your plan to add more
restricted_api_keyHTTP 403test_key_restrictedHTTP 403- test-mode keys can send test email and read, not change the account: use a live key
invalid_parameterHTTP 422
curl -X POST 'https://zapsmtp.xyz/v1/smtp-credentials' \
-H "Authorization: Bearer $ZAP_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "wordpress-shop"
}'const res = await fetch('https://zapsmtp.xyz/v1/smtp-credentials', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ZAP_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "wordpress-shop"
}),
});
// 204 No Content (e.g. a delete) has no body
const data = res.status === 204 ? null : await res.json();
if (!res.ok) throw new Error(`${data.name}: ${data.message}`);
console.log(data);import os
import requests
res = requests.post(
"https://zapsmtp.xyz/v1/smtp-credentials",
headers={"Authorization": f"Bearer {os.environ['ZAP_API_KEY']}"},
json={
"name": "wordpress-shop",
},
timeout=30,
)
res.raise_for_status()
print(res.json() if res.status_code != 204 else "deleted")<?php
$ch = curl_init('https://zapsmtp.xyz/v1/smtp-credentials');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ZAP_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'wordpress-shop',
]),
]);
$data = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($status >= 400) {
throw new RuntimeException($data['message']);
}
print_r($data);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"name": "wordpress-shop"
}`)
req, err := http.NewRequest(
"POST",
"https://zapsmtp.xyz/v1/smtp-credentials",
body,
)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("ZAP_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.Status, string(out))
}require 'net/http'
require 'json'
uri = URI('https://zapsmtp.xyz/v1/smtp-credentials')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = "Bearer #{ENV.fetch('ZAP_API_KEY')}"
req['Content-Type'] = 'application/json'
req.body = {
name: "wordpress-shop"
}.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code, (JSON.parse(res.body) unless res.body.to_s.empty?)import java.net.URI;
import java.net.http.*;
public class ZapRequest {
public static void main(String[] args) throws Exception {
var request = HttpRequest.newBuilder(URI.create("https://zapsmtp.xyz/v1/smtp-credentials"))
.header("Authorization", "Bearer " + System.getenv("ZAP_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"name": "wordpress-shop"
}"""))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://zapsmtp.xyz/v1/smtp-credentials");
request.Headers.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("ZAP_API_KEY"));
request.Content = new StringContent("""
{
"name": "wordpress-shop"
}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");Set
ZAP_API_KEY in your environment.Response 201 Created
{
"id": "019a1f06-4d5e-7f60-8b7c-8d9e0f1a2b3c",
"name": "WordPress",
"username": "smtp_k3f9x2m7q1ab",
"domain_id": null,
"created_at": "2026-10-21T15:35:00Z",
"password": "Xa7Lq2Vb9Rk4Tm1Wc8Np3Zs6Hd0Fj5Gy2Ue7Io4K",
"settings": {
"host": "zapsmtp.xyz",
"ports": {
"465": "TLS",
"587": "STARTTLS",
"2525": "STARTTLS"
},
"mechanisms": [
"PLAIN",
"LOGIN"
]
}
}