Skip to content
Development and deployment2 min read

What is an API?

Short answer

An API (Application Programming Interface) is a set of rules that defines how one program requests data or a service from another. On the web it's usually a set of HTTP URLs you send requests to and get JSON responses from, such as a payment gateway's or an AI model's API.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Parts of a web (REST) API request
  2. Example: a request with curl
  3. Common problems
  4. On ArabyHost

An API works like a restaurant’s order counter: you don’t walk into the kitchen, you order from a fixed menu and get the result. In the same way your store asks a payment gateway to create a transaction, or your app asks a language model to write a reply, without knowing anything about their internal systems.

Parts of a web (REST) API request

Part Example
Endpoint https://api.example.com/v1/orders
Method GET to read, POST to create, PATCH to update, DELETE to remove
Headers Authorization: Bearer ... and Content-Type: application/json
Body JSON data for create and update requests
Status code 200 success, 401 authentication failed, 404 not found, 429 too many requests

Besides REST there are styles such as GraphQL and gRPC; the core idea is the same.

Example: a request with curl

curl -X POST https://api.example.com/v1/orders \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"product_id": 42, "quantity": 2}'

And the response:

{ "id": 1873, "status": "pending" }

$API_KEY comes from your environment variables rather than being typed into the command or code.

Common problems

  • Leaked keys: putting an API key in front-end code or a public repository.
  • 401 or 403: the key is wrong, expired, or lacks the needed permission.
  • 429 Too Many Requests: you hit the rate limit: see the error page.
  • CORS errors in the browser: the service doesn’t allow direct requests from your domain; route the call through your own server instead.
  • Waiting on the API inside page load: one slow call delays the whole page, so push long tasks to the background.

On ArabyHost

You can build APIs in PHP, such as Laravel, on hosting plans, and in Node.js or Python on AI/Developer plans, with a free SSL certificate so your endpoints run over HTTPS. If an outside service will call your site when events happen, read about webhooks. Araby MCP also lets you deploy to your account straight from Claude or Cursor through the MCP protocol.

FAQ

What's the difference between an API and a webhook?

With an API your app asks for data when it needs it. With a webhook the other service sends data to your app automatically when something happens, such as a successful payment.

Where should I keep my API key?

In environment variables or an .env file on the server, never in JavaScript that reaches the browser. Any key visible on the front end can be copied by any visitor.

What does a 429 error from an API mean?

You sent more requests than allowed in a given period (a rate limit). Wait as long as the Retry-After header says if present, and send fewer requests or cache results.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.