Mewayz

On mobile device?

If you are on mobile device, continue by clicking the button below.

Background
Mewayz

Developers API Documentation

Welcome to the Mewayz API documentation. Build powerful integrations and applications using our RESTful API.

Getting Started

Overview

The Mewayz API provides programmatic access to our platform, allowing you to build applications that interact with Mewayz data and functionality. Our API follows REST principles and returns JSON responses.

Base URL

All API requests should be made to:

https://social.mewayz.com/api

Authentication

Most API endpoints require authentication. We use API keys and OAuth 2.0 for authentication:

  • API Key: For server-to-server communication, include your API key in the request header: Authorization: Bearer YOUR_API_KEY
  • OAuth 2.0: For user-authorized applications, use the OAuth 2.0 flow to obtain access tokens

Getting Your API Key

  1. Log in to your Mewayz account
  2. Navigate to Settings → Developer
  3. Click "Create API Key"
  4. Give your application a name and description
  5. Copy and securely store your API key

Important: Never share your API key publicly or commit it to version control.

API Endpoints

Authentication Endpoints

  • POST /api/auth/login - Authenticate and obtain access token
  • POST /api/auth/refresh - Refresh access token
  • POST /api/auth/logout - Invalidate access token

User Endpoints

  • GET /api/user/profile - Get current user profile
  • PUT /api/user/profile - Update user profile
  • GET /api/user/{id} - Get user by ID
  • GET /api/user/{id}/posts - Get user's posts
  • GET /api/user/{id}/followers - Get user's followers
  • GET /api/user/{id}/following - Get users followed by user

Post Endpoints

  • GET /api/posts - Get posts feed
  • POST /api/posts - Create a new post
  • GET /api/posts/{id} - Get post by ID
  • PUT /api/posts/{id} - Update post
  • DELETE /api/posts/{id} - Delete post
  • POST /api/posts/{id}/like - Like a post
  • POST /api/posts/{id}/comment - Comment on a post

Media Endpoints

  • POST /api/media/upload - Upload media file
  • GET /api/media/{id} - Get media by ID
  • DELETE /api/media/{id} - Delete media

Request Format

Headers

All requests should include:

  • Content-Type: application/json
  • Accept: application/json
  • Authorization: Bearer YOUR_ACCESS_TOKEN (for authenticated endpoints)

Example Request

curl -X GET "https://social.mewayz.com/api/user/profile" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Accept: application/json"

Response Format

Success Response

Successful responses return a 200 status code with JSON data:

{
  "success": true,
  "data": {
    "id": 123,
    "username": "example_user",
    "name": "Example User"
  }
}

Error Response

Errors return appropriate HTTP status codes with error details:

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The given data was invalid.",
    "details": {
      "email": ["The email field is required."]
    }
  }
}

Rate Limiting

To ensure fair usage and system stability, API requests are rate-limited:

  • Standard Tier: 1,000 requests per hour per API key
  • Premium Tier: 10,000 requests per hour per API key

Rate limit information is included in response headers:

  • X-RateLimit-Limit - Total requests allowed
  • X-RateLimit-Remaining - Remaining requests in current window
  • X-RateLimit-Reset - Time when rate limit resets (Unix timestamp)

When rate limits are exceeded, requests return a 429 status code.

Pagination

List endpoints support pagination using query parameters:

  • page - Page number (default: 1)
  • per_page - Items per page (default: 20, max: 100)

Example:

GET /api/posts?page=2&per_page=50

Pagination metadata is included in the response:

{
  "data": [...],
  "pagination": {
    "current_page": 2,
    "per_page": 50,
    "total": 150,
    "last_page": 3
  }
}

Webhooks

Subscribe to real-time events using webhooks:

  • Configure webhook URLs in your developer settings
  • Select which events you want to receive
  • Verify webhook signatures for security

Available webhook events:

  • user.created - New user registration
  • post.created - New post published
  • post.updated - Post updated
  • post.deleted - Post deleted
  • comment.created - New comment added

SDKs and Libraries

We provide official SDKs for popular programming languages:

  • JavaScript/TypeScript: npm install @mewayz/sdk
  • Python: pip install mewayz-sdk
  • PHP: composer require mewayz/sdk

Community-maintained libraries may also be available. Check our GitHub organization for more resources.

Best Practices

  • Error Handling: Always implement proper error handling for API responses
  • Rate Limiting: Implement exponential backoff when rate limits are hit
  • Security: Never expose API keys in client-side code
  • Caching: Cache responses when appropriate to reduce API calls
  • Versioning: Use API versioning headers to ensure compatibility
  • Testing: Use our sandbox environment for testing before going live

Support and Resources

  • Documentation: This page and our interactive API explorer
  • Community: Join our developer community forum
  • Support: Contact our developer support team for assistance
  • Status Page: Check API status and uptime

Terms of Use

By using the Mewayz API, you agree to:

  • Comply with our Terms of Use
  • Respect rate limits and usage guidelines
  • Not use the API for spam, abuse, or illegal activities
  • Keep your API keys secure
  • Report security vulnerabilities responsibly

Happy coding! If you have questions or need help, don't hesitate to reach out to our developer support team.