Contact API Documentation

Contact API Documentation

A RESTful Contact Management API with JWT authentication. Integrate powerful address book features into any application.

Authentication

The API uses JWT Bearer tokens. Obtain a token by posting credentials to /auth/login, then include it in the Authorization header of every subsequent request.

Authorization: Bearer <your_access_token>

Access tokens expire after 1 hour. Use the /auth/refresh endpoint with your refresh token to obtain a new access token without re-authenticating.

API Endpoints

Base URL: https://api.yoursite.com/wp-json/addressbook/v1

Auth Endpoints

MethodEndpointDescription
POST/auth/loginGet access + refresh tokens
POST/auth/refreshRefresh access token
GET/auth/meGet current user info

Contact Endpoints

MethodEndpointDescription
GET/contactsList contacts (paginated)
POST/contactsCreate a new contact
GET/contacts/{id}Get a single contact
PUT/contacts/{id}Update a contact
DELETE/contacts/{id}Delete a contact

Query Parameters (GET /contacts)

ParameterTypeDefaultDescription
searchstringSearch name, email, phone
tagstringFilter by tag
pageinteger1Page number
per_pageinteger20Results per page (max 100)
orderbystringnamename | email | created_at
orderstringASCASC | DESC

Request Examples

Login

curl -X POST https://api.yoursite.com/wp-json/addressbook/v1/auth/login \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{"username":"john","password":"secret"}'

List Contacts

curl https://api.yoursite.com/wp-json/addressbook/v1/contacts?search=ali&page=1 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "X-API-Key: YOUR_API_KEY"

Create Contact

curl -X POST https://api.yoursite.com/wp-json/addressbook/v1/contacts \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice Smith","phone":"+1-555-0100","email":"[email protected]","tags":"friends,work"}'

Error Handling

All errors return JSON with success: false and an appropriate HTTP status code.

StatusMeaning
400Bad Request — missing or invalid parameters
401Unauthorized — missing, expired, or invalid JWT
403Forbidden — invalid API key or plan limit reached
404Not Found — contact doesn’t exist
429Rate Limited — slow down requests
500Server Error — something went wrong on our end

Rate Limiting

API calls are limited to 100 requests per minute per IP address. Login attempts are limited to 10 per minute. When rate limited you will receive a 429 response with a Retry-After header.

Ready to build?

Get your API key and start integrating the contact management system into your application.

Get API Access →