Zid Docs
Apps
ThemesPayments
Apps
ThemesPayments
Help Center
Slack
  1. Apps
  • 🗂️ Overview
  • 🚀 Start Here
  • Create your First App
  • Responses
  • Rate Limiting
  • Authorization
  • Embedded Apps
  • StoreFront Events
  • Zid MUI
  • Zid SDKs
  • Our custom MCP server
  • Merchant APIs
    • Account
      • Me
        • Me
        • Profile
      • Store
        • Store
        • Branding
        • Localization
        • Social
        • Operations
        • Business
        • Upload Logo Image
        • Delete Logo Image
        • Upload Icon Image
        • Delete Icon Image
        • Upload Cover Image
        • Delete Cover Image
    • Orders
      • Validate Order Request
      • Create Order
      • Change Order Status
      • Add Order Comment
      • View Order
      • List Orders
      • List Custom Order Statuses
      • List Order Credit Notes
    • Reverse Orders
      • Create Reverse Orders
      • Create Reverse Orders Waybill
      • Add Reverse Order Reasons
      • List Reverse Reasons
      • Calculate Reverse Totals
      • Create refund for reverse order
      • Upload bank transfer receipt
      • Update return products
      • Order Details – View for Return
    • Abandoned Carts
      • List Carts
      • View Cart
    • Products
      • Managing Products
        • Create Product Types
        • Create Product
        • List Products
        • View Product
        • List Product Settings
        • Update Product
        • Bulk Update Products
        • Delete Product
      • Digital Vouchers
        • List Vouchers
        • Order Vouchers
        • Create Voucher
        • Import Vouchers
        • Export Vouchers
        • Update Voucher
        • Remove Voucher
      • Product Categories
        • List Categories
        • View Category
        • Create Category
        • Create Subcategory
        • Update Category
        • Assign Product to Category
        • Bulk Assign Products to Category
        • Publish Category
        • Detach Category from All Products
        • Remove Product from Category
      • Product Badge
        • List Badges
      • Product Attributes
        • List Attributes
        • View Attribute
        • Create Attribute
        • Update Attribute
        • Delete Attribute
      • Product Attribute Presets
        • List Presets
        • Create Preset
        • Update Preset
        • Delete Preset
      • Product Variants
        • Create Variants
        • Create Custom Option
        • Update Custom Option
        • Delete Custom Option Field
        • Create Custom Input Field
        • Update Custom Input Field
        • Delete Custom Input Field
      • Product Sorting
        • Set Manual Product Order
        • Reset Manual Product Order
      • Product Images
        • List Images
        • Upload Image
        • Update Image Order
        • Delete Image
      • Product Availability Notifications
        • Notification Stats
        • Noticiation Settings
        • List Notifications
        • Create Notification
        • Update Settings
        • Send Notification Email
        • Export Notifications
      • Product Export
        • Email All Products to Store Owner
        • Import Products via CSV or xlsx File
      • Product Stock
        • Retrieve Product Stock
        • List Product Stock Records
        • Create Product Stock
        • Update Product Stock
        • Bulk Update Product Stock Records
      • Product Questions & Answers
        • Retrieve Product Question
        • Retrieve Product Answer
        • List Product Questions
        • List Answers for Question
        • Create Product Question
        • Create Product Answer
        • Update Product Question
        • Update Product Answer
        • Delete Product Question
        • Delete Product Answer
      • Product Reviews
        • List Reviews
        • Count Reviews
      • Digital Products
        • Create Downloadable Product
        • Generate Upload URL
        • Upload File to S3
        • Create Product Downloadable
        • Get Product Downloadables
        • Delete Product Downloadable
        • List Store Downloadables
        • Create Store Downloadable
        • Delete Store Downloadable
    • Inventories
      • Create Location
      • Update Location
      • Update Product Stock for Location
      • List Locations
      • View Location
    • Shipping
      • List Store Shipping Methods
    • Marketing
      • Coupons
        • List Coupons
        • View Coupon
        • Create Coupon
        • Generate Bulk Coupons
        • Duplicate Coupon
        • Duplicate Bulk Coupons
        • Update Coupon Note
        • Update Coupon
        • Update Bulk Coupons
        • Update Coupon Status
        • Update Bulk Coupons Status
        • Delete Coupon
        • Delete Bulk Coupons
      • Bundle Offers
        • List Bundle Offers
      • Loyalty Program
        • Loyalty Program Status
        • Loyalty Program Details
        • Loyalty Program Info
        • Customer Loyalty Summary
        • Customer Points History
        • Activate Loyalty Program
        • Set Points Expiration Rules
        • Update Cashback Rule
        • Create Points Redemption Method
        • Update Points Redemption Method
        • Delete Points Redemption Method
        • Adjust Customer Points
      • Discount Rules
        • List Discount Rules
        • View Discount Rule
        • Create Discount Rule
        • Update Discount Rule
    • Customers
      • Customer Tags
        • List Customer Tags
        • Add Customer Tag
        • ْUpdate Customer Tag
        • Delete Customer Tag
      • List Customers
      • View Customer
      • Primary Customer List
      • FInd Customer By Phone Number
      • Customer Profile
      • Add Customer
      • Update Customer
      • Delete Customer
      • Add Bulk Customers
      • Import Customers
    • Store Settings
      • 📄 User Roles and Permissions
      • Retrieve Store Manager Profile
      • Retrieve VAT Settings
      • List Payment Methods
      • List Store Operating Countries
    • Countries and Cities
      • List Countries
      • List Cities for Country
  • Webhooks
    • Overview
    • Webhook Health Tracking
    • Events
      • Order
      • Product
      • Abandoned Cart
      • Customer
      • Product Category
    • APIs
      • Health Summary
      • Broken Webhooks
      • Recover Broken Webhooks
      • List Webhooks
      • Create Webhook
      • Delete Webhook
      • Delete Webhook By subscriber
  • App Management
    • Events
    • APIs
      • Subscription Details
      • Update Usage-Based Charges
  1. Apps

Responses

API Response Codes, Error Handling, and Best Practices
Zid API is built to adhere strictly to REST principles, ensuring seamless communication between clients and our server. Below is a detailed guide to understanding the various HTTP response codes, error handling mechanisms, and best practices to help developers efficiently interact with our API.

Success Response Codes#

We use standard HTTP response codes to indicate the status of API requests. Here’s a breakdown of the success codes:
Color CodeResponseStatusMeaningWhen to Use
#14cc27200OKThe request was successful, and the server returned the requested data.Use this when everything went as expected, and you’re returning data.
#14cc27201CreatedThe request was successful, and a new resource was created.Use this when a new resource has been added to the database.
#14cc27202AcceptedThe request has been accepted for processing, but the processing is not complete.Use this for asynchronous processes where the action hasn’t completed yet.
#14cc27204No ContentThe request was successful, but there is no content to return.Use this when the action has been successfully executed, but there’s no content to send back.

Example Success Response:#

A typical successful response would look like this:
{
  "status": 200,
  "success": true,
  "data": {
    "message": "Request processed successfully.",
    "code": 200
  }
}

Client Error Response Codes#

When a request fails due to client-side issues, the API will return a 4xx error code. Understanding these codes is crucial for diagnosing problems quickly.
Color CodeResponseSlugStatusMeaningTroubleshooting Tips
#fcba03400bad_requestBad RequestThe server could not understand the request due to invalid syntax.Check the request syntax and parameters. Ensure all required fields are included.
#fcba03401unauthorizedUnauthorizedAuthentication is required and has failed or has not yet been provided.Verify API keys or authentication credentials.
#fcba03403forbiddenForbiddenThe server understood the request but refuses to authorize it.Ensure the user has the necessary permissions.
#fcba03404not_foundNot FoundThe requested resource could not be found.Double-check the URL and resource ID.
#fcba03405method_not_allowedMethod Not AllowedThe method specified in the request is not allowed.Verify that you are using the correct HTTP method (GET, POST, etc.).
#fcba03406not_acceptableNot AcceptableThe server cannot produce a response matching the list of acceptable values defined in the request's headers.Adjust the Accept headers in your request.
#fcba03410goneGoneThe resource requested is no longer available and will not be available again.This resource has been permanently removed, and you should clean up references to it.
#fcba03422validation_failedUnprocessable EntityThe server understands the content type and syntax of the request entity, but it was unable to process the contained instructions.Review the data being submitted for missing fields or incorrect formats.
#fcba03429too_many_requestsToo Many RequestsYou have sent too many requests in a given amount of time.Implement retry logic or reduce the request rate.

Example Client Error Response:#

When the request is invalid, you might receive a response like this:
{
  "status": 422,
  "success": false,
  "error": {
    "code": "validation_failed",
    "message": "Invalid input data.",
    "fields": {
      "email": [
        "Email format is invalid."
      ],
      "password": [
        "Password must be at least 8 characters."
      ]
    }
  }
}

Server Error Response Codes#

Server errors indicate a problem with the server processing the request. These errors are generally not caused by the client.
Color CodeResponseSlugStatusMeaningTroubleshooting Tips
#f03c15500server_errorInternal Server ErrorThe server encountered an unexpected condition that prevented it from fulfilling the request.Retry the request later. If the issue persists, contact support.
#f03c15503service_unavailableService UnavailableThe server is not ready to handle the request, often due to temporary overloading or maintenance.Wait and retry the request later.

Example Server Error Response:#

In case of a server error, you might receive the following response:
{
  "status": 500,
  "success": false,
  "error": {
    "code": "server_error",
    "message": "An unexpected error occurred. Please try again later."
  }
}

Handling Multiple Errors in 4xx Responses#

When a request results in multiple errors leading to a 4xx response, our API returns a structured response that includes a list of affected fields and an array of associated error messages. This helps in pinpointing the exact issues for each field.

Example of a Single Field Error:#

{
    "status": 422,
    "success": false,
    "error": {
        "code": "خطأ في التحقق",
        "message": "تحتوي بعض الحقول على بيانات غير صحيحة.",
        "fields": {
            "اسم_المستخدم": [
                "اسم المستخدم مطلوب."
            ]
        }
    }
}

Example of Multiple Field Errors:#

{
    "status": 422,
    "success": false,
    "error": {
        "code": "خطأ في التحقق",
        "message": "تحتوي عدة حقول على بيانات غير صحيحة.",
        "fields": {
            "اسم_المستخدم": [
                "اسم المستخدم مطلوب."
            ],
            "البريد_الإلكتروني": [
                "صيغة البريد الإلكتروني غير صحيحة."
            ],
            "كلمة_المرور": [
                "يجب أن تتكون كلمة المرور من 8 أحرف على الأقل."
            ],
            "تأكيد_كلمة_المرور": [
                "تأكيد كلمة المرور غير متطابق."
            ]
        }
    }
}

Best Practices for API Integration#

To ensure smooth interaction with our API, follow these best practices:
1.
Validate Inputs: Always validate inputs before sending a request to minimize errors.
2.
Handle Rate Limits Gracefully: Implement exponential backoff strategies to handle 429 Too Many Requests responses.
3.
Check for Updates: Periodically check for API updates to stay aligned with the latest changes and enhancements.
4.
Use Correct HTTP Methods: Ensure you are using the appropriate HTTP methods (GET, POST, PUT, DELETE) as per the endpoint requirements.
5.
Test in a Safe Environment: Before deploying changes in production, thoroughly test your integration in a development or staging environment.

Troubleshooting Tips for Developers:#

💡Check Response Headers: Often, additional context is provided in response headers. Always review these when debugging issues.
💡Log All Requests: Maintain logs of all requests and responses, particularly during development, to track down issues more efficiently.
Modified at 2026-02-08 10:06:10
Previous
Create your First App
Next
Rate Limiting
Built with