Server tasks
Server tasks are small pieces of code that run for your site on Xodia, not in your visitor's browser. They do the jobs that need a secret key: send an email, take a payment, ask an AI service or call another service. Your keys stay on Xodia and never reach the page.
On this page
- What server tasks are
- Where they are in Studio
- Add your first task
- Keys and secrets
- Secret or setting
- Which service is it for?
- The code reads this key itself
- Try it in the preview
- Go live
- The safety check
- Run on a schedule
- Limits per plan
- Server tasks for an extra site
- When tasks rest
- Download for your own Cloudflare
- Ask your AI to write a task
- Good to know
What server tasks areLink to this section
A server task is a file in your site's api folder. Each file answers one address on your site: api/contact.ts answers /api/contact. A page on your site calls that address, the task runs on Xodia, talks to the service with your key, and sends a short answer back to the page.
Your page
A visitor sends a form or presses a button.
Your task on Xodia
Runs your code. Your key stays here.
The service
Your email, payment or AI service answers.
You can start from a ready-made task, write your own, or ask your AI to write one. Server tasks are on every plan, within its limits: see Limits per plan.
Where they are in StudioLink to this section
- Server tasks in the top menu lists your site's tasks, what each one needs and when it last ran. Here you choose Add a ready-made task, Update preview, Run on a schedule on a task, and Approve when a change needs your OK.
- Project settings, Server tasks has the switch (On for this site), your schedules, the recent calls in the preview and on your live site, and Download for your own Cloudflare.
- Project settings, Keys and secrets holds the keys your tasks read.
- Project settings, Usage shows this month's calls for the site. Billing shows the calls for the whole workspace.
Add your first taskLink to this section
Open Server tasks
Choose Server tasks in the top menu. If server tasks are off for this site, choose Turn on.
Choose Add a ready-made task
Pick one of the cards and choose Add task. Xodia adds its code to your site's api folder in one step, and you can change or remove it any time.
Follow its setup card
The card lists what is left: Add your keys, Try it in the preview, then Go live. Each key has an Add key button with the form filled in.
The ready-made tasks, each with its own setup guide:
- Send an email: email you when a visitor writes.
- AI answer: answer visitors' questions with your AI service.
- Stripe checkout: take payments with Stripe.
- Call a service: get answers from another service.
- Daily check: check every day that your pages work.
Keys and secretsLink to this section
Open Project settings, Keys and secrets, or choose Add key on a task. Each site can have up to 5 keys on Free, 20 keys on Starter, 50 keys on Pro, 100 keys on Agency.
Secret or settingLink to this section
- Secret is for an API key, a password or a signing secret. It is hidden once saved: nobody sees it again, in Studio, in your code or in your AI. To change it, choose Replace and paste the new value.
- Setting is for a value that isn't secret, like an email address, a web address or a price. You can see it after saving.
Which service is it for?Link to this section
Every secret names the service it is for, like api.example.com, and Xodia only ever sends it there. Your task's code never holds the real key: it gets a stand-in, and Xodia swaps in the real value only in requests to that service. A request to any other address gets the stand-in, so a mistake or bad code can't send your key somewhere else. A secret can name up to 10 services.
The code reads this key itselfLink to this section
A few keys are not sent to a service but checked by your code, like a webhook signing secret. For those, open Advanced in the key's form and turn on The code reads this key itself. The code could send such a key anywhere, so each change to your tasks needs a manager's OK before it can use it.
When a manager updates the preview or goes live, that counts as the OK. When the change came from your AI or from autosave, Server tasks shows a line such as Your latest changes need your OK to use your secret keys. Read what changed, then choose Approve.
Try it in the previewLink to this section
Xodia builds your tasks a few seconds after a change to the api folder, and the preview of your site then answers /api/ addresses with the new code. Choose Update preview in Server tasks to do it at once. Then use your site in the preview: send the form, press the button.
To see what happened, open Project settings, Server tasks, Recent calls, and pick Preview. Each call shows its status, how long it took, the services it reached and what the task wrote while it ran. Calls in the preview count toward the month's calls, and they really run: an email task sends the email.
Go liveLink to this section
Your live site keeps its own copy of your tasks. When you publish your site on Xodia hosting, on its xodia.site address or your own domain, the live copy updates to what the preview has. Until then, the live site keeps running the tasks it had. Recent calls, Live site, shows what visitors' calls did.
Server tasks answer on Xodia hosting. If your site lives on another host, use Download for your own Cloudflare to run them on your own account.
The safety checkLink to this section
Xodia checks each new version of your server tasks when it goes live. Ready-made tasks you haven't changed go straight through. If something in your own code looks unsafe, that version stays held until Xodia's team checks it. Server tasks says so: Your latest version is waiting for a safety check before it goes live. Your preview keeps working meanwhile, and your live site keeps its last checked tasks, if it has any, until then.
You get an email when the version is allowed. If it is kept stopped, the email and Server tasks say why in plain words, with a way to contact us.
Run on a scheduleLink to this section
A task can run on its own, without a visitor. In Server tasks, open the task and choose Run on a schedule, then pick how often:
- Repeat every hour, every 15 minutes or every 5 minutes, as often as your plan allows.
- Every day at a time.
- Every week on the days you pick, at a time.
- Every month on a day from 1 to 28, at a time.
The time is in the time zone you pick, your own to start with, on 5-minute steps. Each run is one call, and the task gets a POST with no body. Pause, Resume or remove a schedule in Project settings, Server tasks, Schedules. Free has no schedules; see Limits per plan.
Limits per planLink to this section
| Free | Starter | Pro | Agency | |
|---|---|---|---|---|
| Sites with server tasks | 1 | 1 | 2 | 3 |
| Calls a month, for all those sites | 2,000 | 15,000 | 30,000 | 30,000 |
| Keys and secrets per site | 5 | 20 | 50 | 100 |
| Schedules per site | No | 2 | 10 | 25 |
| Runs as often as | No | every hour | every 15 minutes | every 5 minutes |
| Download for your own Cloudflare | No | No | Yes | Yes |
Every call, on every plan, may take up to 30 seconds, make up to 10 requests to other services, and use 10 milliseconds of computing time. Waiting for a service doesn't count as computing time, so a task that mostly calls a service fits easily. A visitor's request can be up to 1 MB.
Server tasks for an extra siteLink to this section
On Starter, Pro and Agency, a site past your plan's sites with server tasks can have them for $8 a month, with its own 100,000 calls a month. Those calls are the site's alone, and the site doesn't count toward your plan's sites. When you turn on server tasks and your plan has no room, choose Add for $8 a month. It is charged that day for the rest of the month, then billed with your plan. Owners and admins can add it. Free doesn't have it.
Done with that site? In its Project settings, Server tasks, choose Move to another site and pick a site whose server tasks are off. Its own calls move there, this site's server tasks turn off, and your bill doesn't change. This month's calls stay with the site that made them. Remove add-on stops it, with no refund for the month.
When tasks restLink to this section
Sometimes Xodia pauses a site's tasks for a while. Visitors then get a short answer that the task isn't available right now, and Server tasks says why and until when.
- Calls used up. At 80% of the month's calls, Server tasks warns you. Past 100%, calls keep working a little longer, up to 125% of the month's calls. Then the tasks rest until the month resets, on the 1st (UTC). Upgrade, or give a busy site its own calls with the add-on.
- Too much computing time. A call that uses more than its computing time is stopped. 3 stopped calls within an hour rest the site's tasks for an hour. 20 in a day (UTC) rest them until the day ends. Fix the task, often a loop that runs too long, and they come back on their own.
If Xodia's team stopped a site's tasks, Server tasks says so with Contact us.
Download for your own CloudflareLink to this section
On Pro and Agency, you can take your tasks with you and run them as a Worker on your own Cloudflare account. Your keys are not in the download.
Download
In Project settings, Server tasks, Your own Cloudflare, choose Download for your own Cloudflare. You get a ZIP with your built tasks, their settings, your api files and a README with every step.
Deploy
You need Node.js and a Cloudflare account. In the unzipped folder, run:
Terminalnpx wrangler login npx wrangler deployAdd your keys
The README lists the keys your tasks read. Add each one with the command it gives, then paste the value when asked:
Terminalnpx wrangler secret put EMAIL_KEYPoint your site at it
The Worker answers on its workers.dev address first. Add a route or a custom domain in its settings file to answer on your own site. Schedules come along as cron lines, in UTC.
On your own account, the calls, limits and costs are your Cloudflare account's. Your Xodia site keeps its own copy until you turn server tasks off.
Ask your AI to write a taskLink to this section
Your own AI, connected over MCP, can write a task for you, build it and try it in the preview. Xodia gives it a skill for server tasks, and it follows the same rules: it never sees or sets a key's value, it can't turn tasks on or set a schedule, and its changes reach your live site only when you go live. It tells you the key names to add and when a task should run. See Ways to connect your AI.
Add a server task that emails me each quote request from the form on the Contact page. Tell me which keys to add in Keys and secrets, then try it in the preview.Before your AI tries a task that sends an email, charges or spends on your key, it tells you what will happen and waits for your yes. Each try counts as a call.
Good to knowLink to this section
- Turning server tasks off stops every task on the site until you turn them on again. Keys and schedules are kept.
- Deleting a site turns its server tasks off. If you restore it, turn them on again.
- Anyone can call a task's address, as with any page. Keep tasks small, and set a spending limit at any service that bills you per use.
- Addresses under
/api/are hidden from search engines.