<api version="1.1">
const token = await auth();
"status": "success"
curl -X POST /api/authorize

المطوريين

Build amazing integrations with our powerful API

إصدار API 1.1 — Stable

المستندات

v1.1

This documentation explains how to register, configure, and develop your app so you can successfully use our APIs. Follow the steps below to get started with building your integration.

1
أنشئ تطبيقًا

لكي يتمكن تطبيقك من الوصول إلى واجهات برمجة التطبيقات الخاصة بنا ، يجب عليك تسجيل التطبيق الخاص بك باستخدام لوحة معلومات التطبيق. Registration creates an App ID that lets us know who you are and helps us distinguish your app from other apps.

  1. Create a new App from the dashboard

    إضافة تطبيق جديد
  2. Once you created your App you will receive your credentials:

    app_id app_secret
2
تسجيل الدخول مع

Log in With system is a fast and convenient way for people to create accounts and log into your app. It enables two scenarios: authentication and asking for permissions to access people's data.

  1. Direct users to the OAuth login page using this link:

    HTML
    <a href="https://scriptstribe.com/api/oauth?app_id=YOUR_APP_ID">
        Log in With ScriptsTribe
    </a>

    The user will be redirected to the Log in With page:

    Login With Screenshot
  2. Once the user accepts your app, they will be redirected to your Redirect URL with an auth_key:

    URL
    https://yourdomain.com/callback.php?auth_key=AUTH_KEY

    Note: The auth_key is valid for one-time use only. Once used, you'll need to redirect the user through the OAuth flow again.

3
Access Token

After receiving the auth_key, exchange it for an access_token to make API requests.

  1. Make an HTTP POST request to the authorize endpoint:

    PHP
    <?php
    
    $app_id = "YOUR_APP_ID";
    $app_secret = "YOUR_APP_SECRET";
    $auth_key = $_GET['auth_key'];
    
    $postData = [
        'app_id' => $app_id,
        'app_secret' => $app_secret,
        'auth_key' => $auth_key
    ];
    
    $ch = curl_init('https://scriptstribe.com/api/authorize');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
    
    $response = curl_exec($ch);
    
    if (curl_errno($ch)) {
        die('cURL error: ' . curl_error($ch));
    }
    
    curl_close($ch);
    
    $json = json_decode($response, true);
    
    if (!empty($json['access_token'])) {
        $access_token = $json['access_token'];
    }
    
    ?>

    Note: The access_token is valid for 1 hour. After expiration, redirect the user through OAuth again.

4
API Endpoints

With your access_token, you can now make API requests:

GET api/get_user_info

Retrieve authenticated user information

Example request:

PHP
$response = file_get_contents(
    "https://scriptstribe.com/api/get_user_info?access_token=" . $access_token
);
$userData = json_decode($response, true);

Response:

JSON
{
    "user_info": {
        "user_id": "123",
        "user_name": "johndoe",
        "user_email": "john@example.com",
        "user_firstname": "John",
        "user_lastname": "Doe",
        "user_gender": "male",
        "user_birthdate": "1990-01-15",
        "user_picture": "https://...",
        "user_cover": "https://...",
        "user_registered": "2024-01-01",
        "user_verified": "1",
        "user_relationship": "single",
        "user_biography": "Hello world!",
        "user_website": "https://johndoe.com"
    }
}
ScriptsTribe https://scriptstribe.com