API Documentation

General Information

The Fembed API provides all data available on the dashboard


Fembed exposes its data via an Application Programming Interface (API), so developers can interact in a programmatic way with the Fembed application. This document is the official reference for that functionality. The current API version is 1.0.5

The Base-URL for all api calls:

https://www.fembed.com/api

Making Request

All calls to the API shall be HTTP/1.1 POST, most calls require ClIENT_ID and ClIENT_SECRET, you can find them in My Account

curl -X POST https://www.fembed.com/api/ACTION
-d "client_id=ClIENT_ID&client_secret=ClIENT_SECRET"
-H "Content-Type: application/x-www-form-urlencoded"

Response format

Response is Json, structure is as follows:

{
    "success": boolean | TRUE or FALSE
    "data": mix | depend on the request
}

Before checking json response, you should check http code returned

200: Everything is OK. Request succeeded

50x: Errors from our end. You should not see this, but be prepared.

API Calls

The list all api calls available on the latest version of our API


Account Information

curl -X POST https://www.fembed.com/api/account
-d "client_id=ClIENT_ID&client_secret=ClIENT_SECRET"
-H "Content-Type: application/x-www-form-urlencoded"
  • client_id: Required, your ClIENT_ID
  • client_secret: Required, your ClIENT_SECRET

The success response

{
    "success": true
    "data": {
        "id": 2097657,
        "display_name": "John Doe",
        "email": "[email protected]",
        "credit": 988,
        "is_active": true,
        "reason": null,
        "is_subscribe": true,
        "created_at": "2018-01-24 20:41:22"
    }
}

The error response

{
    "success": false
    "data": "403 your account is banned"
}

This call will return upload url and token for your next upload call, the token is only valid 1 hour

curl -X POST https://www.fembed.com/api/upload
-d "client_id=ClIENT_ID&client_secret=ClIENT_SECRET"
-H "Content-Type: application/x-www-form-urlencoded"
  • client_id: Required, your ClIENT_ID
  • client_secret: Required, your ClIENT_SECRET

The successfully response

{
    "success": true,
    "data": {
        "url": "https://www.fembed.com/upload/",
        "token": "43tds46rgsrrere"
    }
}

The error response

{
    "success": false
    "data": "403 invalid client secret"
}

Upload Video

We use Tus Resumable upload protocol, version 1.0.0, so you can use any tus clients you want to upload video. upload url is your endpoint, and upload token must be included in Upload-Metadata header with key is token. Please visit Tus.io for more information

Upload-Metadata must include key name too,it's value is name of file will upload

Tus Clients: Please check at https://tus.io/implementations.html

When uploaded successfully, you have to exec the final upload api call to get fembed video id. Please note that video id may be delayed by a short duration, so it may not available immediately, but may upto maximum 20 seconds. If after 20 seconds still not available then the video is not encode-able so it was removed

curl -X POST https://www.fembed.com/api/fingerprint
-d "client_id=ClIENT_ID&client_secret=ClIENT_SECRET"
-d "file_fingerprint=8642rwre4sd3"
-H "Content-Type: application/x-www-form-urlencoded"
  • client_id: Required, your ClIENT_ID
  • client_secret: Required, your ClIENT_SECRET
  • file_fingerprint: Required, fingerprint of file.
    eg upload url is https://www.fembed.com/upload/8642rwre4sd3 then fingerprint is 8642rwre4sd3

The successfully response

{
    "success": true
    "data": FembedVideoId
}

The error response

{
    "success": false
    "data": "404 fingerprint not found"
}

Upload Video Caption

We support 2 types of captions/subtitles: WebVTT, SRT. Multiple cap/sub per video is allowed.

curl -X POST https://www.fembed.com/api/caption
-d "client_id=ClIENT_ID&client_secret=ClIENT_SECRET"
-d "file_id=IdOfVideo&captions=JSON_ENCODED"
-H "Content-Type: application/x-www-form-urlencoded"
  • client_id: Required, your ClIENT_ID
  • client_secret: Required, your ClIENT_SECRET
  • file_id: Required, ID of target video
  • captions: Required, JSON encoded array contain object of each caption info.
    eg [{"title": "English", "type": "vtt", "content": "content from php file_get_contents()"},{"title": "Japanese"....}]

The successfully response

{
    "success": true
    "data": ["English", "Japanese"]
}

The error response

{
    "success": false
    "data": "404 video not found"
}

Upload Video Poster

We support only jpg, jpeg, png image file. the old poster will be remove if new poster uploaded successfully.

curl -X POST https://www.fembed.com/api/poster
-d "client_id=ClIENT_ID&client_secret=ClIENT_SECRET"
-d "file_id=IdOfVideo&poster=JSON_ENCODED"
-H "Content-Type: application/x-www-form-urlencoded"
  • client_id: Required, your ClIENT_ID
  • client_secret: Required, your ClIENT_SECRET
  • file_id: Required, ID of target video
  • poster: Required, json object contain image info.
    eg {"type": "jpg", "content": "content from php file_get_contents()"}

The successfully response

{
    "success": true
    "data": "IdOfVideo"
}

The error response

{
    "success": false
    "data": "400 not a valid image"
}

Video Information

curl -X POST https://www.fembed.com/api/file
-d "client_id=ClIENT_ID&client_secret=ClIENT_SECRET"
-d "file_id=IdOfVideo"
-H "Content-Type: application/x-www-form-urlencoded"
  • client_id: Optional, your ClIENT_ID, if not then return public info instead of full infos
  • client_secret: Optional, your ClIENT_SECRET, if not then return public info instead of full infos
  • file_id: Required, ID of video you want to check
Private video and Public video

If video is private, client_id and client_secret are required, otherwise 403 error will returned


The success response

{
    "success": true
    "data": {
        "status": "Removed",
        "reason": "Removed by user"
    }
}

The error response

{
    "success": false
    "data": "404 file not found"
}

This is premium feature, your account must have enough credits. Return direct streaming links that you can use on your own player

curl -X POST https://www.fembed.com/api/streaming
-d "client_id=ClIENT_ID&client_secret=ClIENT_SECRET"
-d "file_id=IdOfVideo&ip_address=12.34.56.78"
-H "Content-Type: application/x-www-form-urlencoded"
  • client_id: Required, your ClIENT_ID
  • client_secret: Required, your ClIENT_SECRET
  • file_id: Required, your video id
  • ip_address: Optional, streaming link is playable for this IP only. If not then streaming link will not restrict base on IP

The successfully response

{
    "success": true
    "data": {
        "360p": "https://www.fembed.com/direct/title-360p.mp4",
        "480p": "https://www.fembed.com/direct/title-480p.mp4",
        "720p": "https://www.fembed.com/direct/title-720p.mp4",
        "1080p": "https://www.fembed.com/direct/title-1080p.mp4",
    }
}

The error response

{
    "success": false
    "data": "403 your account is out of credits"
}
Top