MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

Authenticating requests

This API is not authenticated.

Agency Earnings

Get agency earnings

requires authentication

Returns agency earnings grouped by date. if from and to query parameters have been provided it will return the agency earning during this period of time.

Example request:
curl --request GET \
    --get "https://api.metapic.com/agency/dashboard/vero?from=2019-01-01&to=2019-01-02" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "Authorization: {token}"
const url = new URL(
    "https://api.metapic.com/agency/dashboard/vero"
);

const params = {
    "from": "2019-01-01",
    "to": "2019-01-02",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "{token}",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "dates": [
        {
            "date": "2022-04-10",
            "user_earnings": 2349774,
            "agency_earnings": 0,
            "agency_earnings_avg": 0
        },
        {
            "date": "2022-04-11",
            "user_earnings": "1713475",
            "agency_earnings": "0",
            "agency_earnings_avg": 0
        },
        {
            "date": "2022-04-12",
            "user_earnings": "2397901",
            "agency_earnings": "0",
            "agency_earnings_avg": 0
        }
    ],
    "total_agency_earnings": 2655,
    "total_agency_earnings_formatted": "26.55 €",
    "total_user_earnings": 78542586,
    "total_user_earnings_formatted": "785 425.86 €",
    "active_users": 953,
    "agency_avg_earnings": 0.0036999999999999997,
    "nr_of_posts": 3267
}
 

Request      

GET agency/dashboard/{clientId}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Authorization      

Example: {token}

URL Parameters

clientId   string   

Example: vero

Query Parameters

from   string  optional  

Date (Y-m-d). Must be a valid date. Example: 2019-01-01

to   string  optional  

Date (Y-m-d). Must be a valid date. Example: 2019-01-02

Agency login

Login as an agency

Return the current logged in user info or unauthorized error if the user login info is incorrect or if the user doesn't have permission

Example request:
curl --request POST \
    "https://api.metapic.com/agencies/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "Authorization: {token}" \
    --data "{
    \"email\": \"example@gmail.com\",
    \"password\": \"K9x*\\\\VL*bcxmhkgsL\\\"B\"
}"
const url = new URL(
    "https://api.metapic.com/agencies/login"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "{token}",
};

let body = {
    "email": "example@gmail.com",
    "password": "K9x*\\VL*bcxmhkgsL\"B"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "id": "{user_id}",
    "username": "",
    "email": "example@metapic.com",
    "phone": null,
    "created_at": "2022-08-02 15:23:53",
    "updated_at": "2022-08-15 13:17:56",
    "admin": 1,
    "last_active": "2022-08-15T11:17:56.359046Z",
    "first_name": "",
    "surname": "",
    "vat_no": null,
    "country": "",
    "city": "",
    "address": "",
    "postcode": "",
    "tier_pricing_type": "",
    "config": "",
    "sign_user_agreement": "2022-08-02 15:23:55",
    "revenue_tier_id": 107,
    "recruitment_utm": null,
    "access_token": "{ access_token }",
    "is_suspended": false,
    "is_verified": true,
    "revenue_tier": {
        "id": 107,
        "created_at": "2018-12-12 14:21:45",
        "updated_at": "2021-12-01 12:05:56",
        "client_id": 79,
        "revenue_share": "0.00",
        "instagram_revenue_share": "0.00",
        "name": "Not Approved"
    },
    "client": {
        "id": 79,
        "client_id": "949469247648506",
        "payment_organization_id": null,
        "name": "Metapic GB",
        "created_at": "2018-12-12 14:21:45",
        "updated_at": "2021-08-03 12:48:21",
        "own_paymentsystem": 0,
        "config": "{    \"tabs\": {        \"home\":{\"showMenu\":true},        \"find\":{\"showMenu\":true},\t\"collage\":{\"showMenu\":true},\t\"tagEditor\":{\"showMenu\":true},        \"stats\":{\"showMenu\":true},\t\"listLinks\":{\"showMenu\":true}    },    \"canLogin\": true}",
        "user_mail_config": {
            "accepted": "uk-welcome-to-metapic",
            "registered": "we-ve-received-your-application"
        },
        "feed": "live_gb",
        "locale": "GB",
        "revenue_model": "blog_percentage",
        "revenue_share": "0.00",
        "store_group_id": 17,
        "default_revenue_tier": 107,
        "default_verified_users": 0,
        "storegroup": {
            "id": 17,
            "name": "Standard GB",
            "shopello": 0,
            "key": "gb",
            "locale": "GB",
            "lang": "en",
            "currency": "GBP",
            "es": 0,
            "payment_limit": 5000,
            "paid_to_account": "550-5185",
            "our_reference": "Tobias Sjödin",
            "currency_obj": {
                "code": "GBP",
                "name": "Pound sterling",
                "symbol": "£",
                "subunit": "p",
                "is_before": 1,
                "ratio_to_eur": 1.16
            }
        }
    }
}
 

Request      

POST agencies/login

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Authorization      

Example: {token}

Body Parameters

email   string   

required. Example: example@gmail.com

password   string   

required. Example: K9x*\VL*bcxmhkgsL"B

Endpoints

Get client user permission config the agency user.

Example request:
curl --request GET \
    --get "https://api.metapic.com/agency/user/permissions/qui" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "Authorization: {token}"
const url = new URL(
    "https://api.metapic.com/agency/user/permissions/qui"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "{token}",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Request      

GET agency/user/permissions/{clientId}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Authorization      

Example: {token}

URL Parameters

clientId   string   

Example: qui

User Earnings

Get agency's user earnings

requires authentication

Returns client earnings grouped by username. if from and to query parameters have been provided it will return the client earning during this period of time, you can also provide the username to search for a specific user.

Example request:
curl --request GET \
    --get "https://api.metapic.com/agency/influencers/est?username=occaecati&from=2019-01-01&to=2019-01-02&sort=blanditiis&orderBy=iure&format=facilis" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "Authorization: {token}"
const url = new URL(
    "https://api.metapic.com/agency/influencers/est"
);

const params = {
    "username": "occaecati",
    "from": "2019-01-01",
    "to": "2019-01-02",
    "sort": "blanditiis",
    "orderBy": "iure",
    "format": "facilis",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "{token}",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "current_page": 1,
    "data": [
        {
            "date": "2019-03-02",
            "user_id": "{userId}",
            "username": "{userName}",
            "client_id": "{clientID}",
            "clicks": 15,
            "user_earnings": 1924,
            "agency_earnings": 0
        },
        {
            "date": "2020-04-14",
            "user_id": "{userId}",
            "username": "{userName}",
            "client_id": "{clientID}",
            "clicks": 376,
            "user_earnings": 8879,
            "agency_earnings": 0
        },
        {
            "date": "2019-07-12",
            "user_id": "{userId}",
            "username": "{userName}",
            "client_id": "{clientID}",
            "clicks": 0,
            "user_earnings": 200,
            "agency_earnings": 0
        }
    ],
    "first_page_url": "https://api.metapic.com/agency/influencers?page=1",
    "from": 1,
    "last_page": 58,
    "last_page_url": "https://api.metapic.com/agency/influencers?page=58",
    "links": [
        {
            "url": null,
            "label": "« Previous",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=2",
            "label": "2",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=3",
            "label": "3",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=4",
            "label": "4",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=5",
            "label": "5",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=6",
            "label": "6",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=7",
            "label": "7",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=8",
            "label": "8",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=9",
            "label": "9",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=10",
            "label": "10",
            "active": false
        },
        {
            "url": null,
            "label": "...",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=57",
            "label": "57",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=58",
            "label": "58",
            "active": false
        },
        {
            "url": "https://api.metapic.com/agency/influencers?page=2",
            "label": "Next »",
            "active": false
        }
    ],
    "next_page_url": "https://api.metapic.com/agency/influencers?page=2",
    "path": "https://api.metapic.com/agency/influencers",
    "per_page": 15,
    "prev_page_url": null,
    "to": 15,
    "total": 862
}
 

Request      

GET agency/influencers/{clientId}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Authorization      

Example: {token}

URL Parameters

clientId   string   

Example: est

Query Parameters

username   string  optional  

String search client influencers by username Example: occaecati

from   string  optional  

Date (Y-m-d). Must be a valid date. Example: 2019-01-01

to   string  optional  

Date (Y-m-d). Must be a valid date. Example: 2019-01-02

sort   string  optional  

String sort in ascending or descending order. Must be one of asc or desc. Example: blanditiis

orderBy   string  optional  

String order data by a specific column. Must be one of clicks, agency_earnings, or user_earnings. Example: iure

format   string  optional  

String export data in a specific format Must be one of csv, xlsx, or json. Example: facilis