Skip to content

Commit 63b1edd

Browse files
committed
docs: add REST API availability and subdomain support
- Remove 'Workers binding only' and 'top-level domain required' limitations - Add REST API page with endpoint, auth, and curl example - Link to REST API reference across index, get-started, and API pages - Subdomains are now supported (removed top-level domain restriction)
1 parent 6249dac commit 63b1edd

4 files changed

Lines changed: 48 additions & 6 deletions

File tree

src/content/docs/email-service/api/send-emails/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Send emails
33
pcx_content_type: navigation
44
summary: |
5-
API reference for sending emails with Cloudflare Email Service using Workers API.
5+
API reference for sending emails with Cloudflare Email Service using the Workers API or REST API.
66
sidebar:
77
order: 1
88
group:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: REST API
3+
pcx_content_type: concept
4+
sidebar:
5+
order: 2
6+
---
7+
8+
The REST API allows you to send emails from any application using standard HTTP requests. This is useful for applications that are not built on Cloudflare Workers or when you need to send emails from external services.
9+
10+
## Endpoint
11+
12+
Send an email using the [Email Sending REST API](https://developers.cloudflare.com/api/resources/email_sending/methods/send).
13+
14+
```txt
15+
POST https://api.cloudflare.com/client/v4/accounts/{account_id}/email-service/send
16+
```
17+
18+
## Authentication
19+
20+
Authenticate using a Cloudflare API token with the appropriate permissions. Include the token in the `Authorization` header:
21+
22+
```txt
23+
Authorization: Bearer <API_TOKEN>
24+
```
25+
26+
## Example
27+
28+
```bash
29+
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/email-service/send" \
30+
--header "Authorization: Bearer <API_TOKEN>" \
31+
--header "Content-Type: application/json" \
32+
--data '{
33+
"to": "recipient@example.com",
34+
"from": "sender@yourdomain.com",
35+
"subject": "Hello from Email Service",
36+
"html": "<h1>Hello!</h1><p>This email was sent using the REST API.</p>",
37+
"text": "Hello! This email was sent using the REST API."
38+
}'
39+
```
40+
41+
## Next steps
42+
43+
- Refer to the [REST API reference](https://developers.cloudflare.com/api/resources/email_sending/methods/send) for full request and response schemas.
44+
- See the [Workers API](/email-service/api/send-emails/workers-api/) for sending emails directly from Cloudflare Workers.

src/content/docs/email-service/get-started/send-emails.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from "~/components";
1818
import DomainSetup from "~/content/partials/email-service/_domain-setup-sending.mdx";
1919

20-
Send emails from your applications using Cloudflare Email Service with the Workers API.
20+
Send emails from your applications using Cloudflare Email Service with the Workers API or the [REST API](https://developers.cloudflare.com/api/resources/email_sending/methods/send).
2121

2222
:::note
2323
You must be using Cloudflare DNS to use Email Service.

src/content/docs/email-service/index.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ Cloudflare Email Service is currently in private beta. Access is limited to appr
3232
**Known limitations:**
3333

3434
- Your domain must use Cloudflare DNS
35-
- You must use the Workers binding (REST API is not available)
3635
- Email templates are not available
37-
- You must onboard the top-level domain to use Email Sending and/or Email Routing
3836

3937
Many of these will be addressed over the course of the private and public beta.
4038
:::
@@ -52,7 +50,7 @@ Together, these two features make it possible for you to send and receive emails
5250
- Custom email addresses (support@, contact@, orders@)
5351
- Emails as a mode of interaction for agents, such as send an email to create an issue in ticket tracking
5452

55-
Access Email Service from Cloudflare Workers using Workers Bindings:
53+
Access Email Service from Cloudflare Workers using Workers Bindings or via the [REST API](https://developers.cloudflare.com/api/resources/email_sending/methods/send):
5654

5755
<Tabs>
5856
<TabItem label="index.ts">
@@ -147,7 +145,7 @@ See the full [Workers Email API reference](/email-service/api/send-emails/worker
147145
</Feature>
148146
149147
<Feature header="Workers API" href="/email-service/api/">
150-
Send and route emails using the native Workers API.
148+
Send and route emails using the native Workers API or the [REST API](https://developers.cloudflare.com/api/resources/email_sending/methods/send).
151149
</Feature>
152150
153151
---

0 commit comments

Comments
 (0)