# API endpoints

**Shipped** uses Next.js 14 latest features, which include the new App Router.

The API endpoints of your product live in the `/app/api/` folder. Any `route.ts` file, and each folder and subfolder, take part to the final endpoint URL.<br>

For example:

/app/api/user/routes.ts -> <http://localhost:3000/api/user>

/app/api/user/profile/routes.ts -> <http://localhost:3000/api/user/profile>

/app/api/user/\[id]/profile -> <http://localhost:3000/api/user/1234/profile><br>

The logic of each route resides in the `route.ts` files.

### Make an API call from your website

To make API calls, use the library `axios`.

```typescript

import axios from "axios";
import toast from "react-hot-toast";


axios
  .post("/api/waitlist", {
    email,
  })
  .then(() => {
    toast.success("You've been added to the waitlist!");
  })
  .catch(() => {
    toast.error("Something went wrong. Please try again later.");
  })
  .finally(() => {
    setLoading(false);
  });
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shipped.club/features/api-endpoints.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
