Skip to main content

FAQ API Documentation

Public Endpoints

Get All FAQs

Retrieves a list of all FAQs, sorted by creation date (oldest first).

Endpoint: GET /api/v1/faq

Authentication: None required

Response:

[
{
"_id": "65f9a8b7c4d3e2f1a8b9c0d1",
"title": "How do I create an account?",
"message": "To create an account, click on the 'Sign Up' button on the homepage and fill in your details.",
"createdAt": "2025-10-01T10:00:00.000Z",
"updatedAt": "2025-10-01T10:00:00.000Z"
},
{
"_id": "65f9a8b7c4d3e2f1a8b9c0d2",
"title": "How do I reset my password?",
"message": "Click on 'Forgot Password' on the login page and follow the instructions sent to your email.",
"createdAt": "2025-10-02T11:30:00.000Z",
"updatedAt": "2025-10-02T11:30:00.000Z"
}
]

Status Codes:

  • 200 - Success

Get Single FAQ

Retrieves a specific FAQ by ID.

Endpoint: GET /api/v1/faq/:id

Authentication: None required

Parameters:

  • id (path parameter) - MongoDB ObjectId of the FAQ

Response:

{
"_id": "65f9a8b7c4d3e2f1a8b9c0d1",
"title": "How do I create an account?",
"message": "To create an account, click on the 'Sign Up' button on the homepage and fill in your details.",
"createdAt": "2025-10-01T10:00:00.000Z",
"updatedAt": "2025-10-01T10:00:00.000Z"
}

Status Codes:

  • 200 - Success
  • 404 - FAQ not found
  • 400 - Invalid FAQ ID format

Admin Endpoints

All admin endpoints require authentication.

Get All FAQs (Admin)

Retrieves all FAQs, sorted by creation date (newest first).

Endpoint: GET /api/admin/faq

Authentication: Required (Admin)

Response:

[
{
"_id": "65f9a8b7c4d3e2f1a8b9c0d2",
"title": "How do I reset my password?",
"message": "Click on 'Forgot Password' on the login page and follow the instructions sent to your email.",
"createdAt": "2025-10-02T11:30:00.000Z",
"updatedAt": "2025-10-02T11:30:00.000Z"
},
{
"_id": "65f9a8b7c4d3e2f1a8b9c0d1",
"title": "How do I create an account?",
"message": "To create an account, click on the 'Sign Up' button on the homepage and fill in your details.",
"createdAt": "2025-10-01T10:00:00.000Z",
"updatedAt": "2025-10-01T10:00:00.000Z"
}
]

Status Codes:

  • 200 - Success
  • 500 - Server error

Create FAQ

Creates a new FAQ entry.

Endpoint: POST /api/admin/faq

Authentication: Required (Admin)

Request Body:

{
"title": "How do I delete my account?",
"message": "To delete your account, go to Settings > Account > Delete Account and confirm the action."
}

Required Fields:

  • title (string) - FAQ question or title
  • message (string) - FAQ answer or message

Response:

{
"_id": "65f9a8b7c4d3e2f1a8b9c0d3",
"title": "How do I delete my account?",
"message": "To delete your account, go to Settings > Account > Delete Account and confirm the action.",
"createdAt": "2025-10-03T14:20:00.000Z",
"updatedAt": "2025-10-03T14:20:00.000Z"
}

Status Codes:

  • 201 - Created successfully
  • 400 - Missing required fields (title or message)
  • 500 - Server error

Get Single FAQ (Admin)

Retrieves a specific FAQ by ID.

Endpoint: GET /api/admin/faq/:id

Authentication: Required (Admin)

Parameters:

  • id (path parameter) - MongoDB ObjectId of the FAQ

Response:

{
"_id": "65f9a8b7c4d3e2f1a8b9c0d1",
"title": "How do I create an account?",
"message": "To create an account, click on the 'Sign Up' button on the homepage and fill in your details.",
"createdAt": "2025-10-01T10:00:00.000Z",
"updatedAt": "2025-10-01T10:00:00.000Z"
}

Status Codes:

  • 200 - Success
  • 404 - FAQ not found
  • 500 - Server error

Update FAQ

Updates an existing FAQ. Only provided fields will be updated.

Endpoint: PATCH /api/admin/faq/:id

Authentication: Required (Admin)

Parameters:

  • id (path parameter) - MongoDB ObjectId of the FAQ

Request Body:

{
"title": "How do I create a new account?",
"message": "To create a new account, visit our signup page and complete the registration form."
}

Optional Fields:

  • title (string) - Updated FAQ title
  • message (string) - Updated FAQ message

Response:

{
"_id": "65f9a8b7c4d3e2f1a8b9c0d1",
"title": "How do I create a new account?",
"message": "To create a new account, visit our signup page and complete the registration form.",
"createdAt": "2025-10-01T10:00:00.000Z",
"updatedAt": "2025-10-03T15:45:00.000Z"
}

Status Codes:

  • 200 - Updated successfully
  • 404 - FAQ not found
  • 500 - Server error

Delete FAQ

Permanently deletes an FAQ entry.

Endpoint: DELETE /api/admin/faq/:id

Authentication: Required (Admin)

Parameters:

  • id (path parameter) - MongoDB ObjectId of the FAQ

Response:

{
"ok": true
}

Status Codes:

  • 200 - Deleted successfully
  • 404 - FAQ not found
  • 500 - Server error

Data Model

FieldTypeRequiredDescription
_idObjectIdAutoUnique identifier
titleStringYesFAQ question or title
messageStringYesFAQ answer or detailed message
createdAtDateAutoCreation timestamp
updatedAtDateAutoLast update timestamp

Example Usage

Creating a FAQ

curl -X POST https://api.zishes.com/api/admin/faq \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{
"title": "How do I contact support?",
"message": "You can contact our support team at support@zishes.com or through the in-app chat."
}'

Updating a FAQ

curl -X PATCH https://api.zishes.com/api/admin/faq/65f9a8b7c4d3e2f1a8b9c0d1 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{
"message": "Contact us at help@zishes.com or use the chat feature in the app."
}'

Deleting a FAQ

curl -X DELETE https://api.zishes.com/api/admin/faq/65f9a8b7c4d3e2f1a8b9c0d1 \
-H "Authorization: Bearer <token>"

Getting All FAQs (Public)

curl https://api.zishes.com/api/v1/faq