# Built-in API utilities

ShipWithDjango comes with several pre-built API utilities to help you quickly get started with building and managing APIs. These utilities are designed to handle common tasks such as user authentication, token management, and retrieving user profile information, ensuring that you have a solid foundation for your API from the start.

### API Structure

The API functionality in ShipWithDjango is located in the `api` folder in the root of your project. This folder contains everything you need to get started with creating and managing API endpoints, including serializers, views, and URLs.

#### User Authentication and Token Management

ShipWithDjango provides built-in endpoints for user authentication using JSON Web Tokens (JWT). The API includes endpoints that allow users to obtain Bearer tokens and refresh tokens, which are essential for securely managing user sessions in your API.

* **Token Obtain Pair Endpoint**: This endpoint allows users to authenticate and receive a pair of tokens: an access token (Bearer token) and a refresh token. The access token is used for authenticating API requests, while the refresh token is used to obtain a new access token when the old one expires.\
  \
  You can find the endpoint at `/api/token/`
* **Token Refresh Endpoint**: This endpoint allows users to refresh their access token using the refresh token. This is crucial for maintaining user sessions without requiring them to re-authenticate frequently.\
  \
  You can find the endpoint at `/api/token/refresh/`

#### User Profile Endpoint

ShipWithDjango also includes an endpoint that allows authenticated users to retrieve their own profile information. This is useful for creating user dashboards, account management pages, or any feature that requires displaying user-specific data.

* **User Profile Retrieval**: The user profile endpoint returns detailed information about the authenticated user, including their email, name, date of registration, and any associated subscription or billing information. This ensures that you can easily access and display the necessary user data in your application.

You can find the endpoint at `/users/me/`


---

# 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.shipwithdjango.com/api/built-in-api-utilities.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.
