Tasks API

See what the robot is doing and put tasks that ended with a problem or an error back in the queue once the cause is fixed. You can also queue a login or turn on 2FA for an account. Parameters, errors and sample responses are below.

01 What the functions do

These functions let you manage the robot task queue without the interface: view the tasks, queue a login or 2FA, remove what you do not need and restart what failed. It helps when you have a lot of accounts or when your own program runs the queue. How to call a function and read the response is in the API catalog.

  • Watch the queue. task/list returns the tasks of one account or of all your accounts at once and filters them by type and status. Each task has a status, an error code, a counter of re-launches and the times it was queued, started and finished.
  • Find tasks with a problem and restart them. Filter task/list by status=3 (Problem), then by status=4 (Error). Remove the cause, for example replace a proxy that does not work, and put the task back in the queue with task/restart.
  • Queue a task. task/add queues a login (login) or turning on two-factor authentication (make2fa) for an account. For make2fa you can set a delay in hours. If the account queue already holds the same unfinished task, the new one is not added.
  • Remove a task you do not need. task/del removes a task from the account queue and releases the task that follows it. System registration tasks and successfully completed tasks cannot be deleted.
Back to contents

02 Listing tasks

URLhttps://ggl.farm/api/task/list.json?id={apitoken}

Returns the tasks in the queue. With the acc parameter you get the tasks of one account. Without it you get the tasks of all your accounts. Tasks come in the order they were added, by ascending ID.

Parameters

FieldDescription
accAccount ID in GGL. If you pass it, only the tasks of that account are returned.
typeTask type, by name (make2fa — 2FA, login — login) or by number (1 — Registration, 2 — Farm, 3 — Statistics, 4 — 2FA, 5 — Login).
statusTask status: 0 — In queue, 1 — Waiting, 2 — Working, 3 — Problem, 4 — Error, 5 — Success.
pagePage number, 1 by default. Pages are numbered from 1.
showHow many tasks to return per page, 100 by default. There is no upper limit.

Response

FieldDescription
navPagination. The fields are described below.
datasetValue dictionaries: types — task type names, statuses — task status names. The key in a dictionary is the number from the task fields.
dataThe tasks. It is an object: the key is the task ID, the value holds the task fields, which are described below.

Fields of the nav block:

FieldDescription
totalHow many tasks in total.
pageCurrent page.
pagesHow many pages.
showTasks per page.

Task fields:

FieldDescription
idTask ID in GGL.
accID of the account the task belongs to.
typeTask type as a number. Look up the name in the dataset.types dictionary.
statusTask status as a number. Look up the name in the dataset.statuses dictionary.
errorError code of the task run. 0 — no error.
retryHow many times the task was re-launched.
createWhen the task was queued, UNIX timestamp.
delayThe time from which the task can be launched, UNIX timestamp. 0 — it can run at once.
startWhen the task was last launched, UNIX timestamp. 0 — it has not run yet.
finishWhen the task last finished, UNIX timestamp. 0 — it has not finished yet.
{
    "status": "ok",
    "nav": {
        "total": 3,
        "page": 1,
        "pages": 1,
        "show": 100
    },
    "dataset": {
        "types": {
            "1": "Registration",
            "2": "Farm",
            "3": "Statistics",
            "4": "2FA",
            "5": "Login"
        },
        "statuses": {
            "0": "In queue",
            "1": "Waiting",
            "2": "Working",
            "3": "Problem",
            "4": "Error",
            "5": "Success"
        }
    },
    "data": {
        "1041": {
            "id": 1041,
            "acc": 666,
            "type": 5,
            "status": 5,
            "error": 0,
            "retry": 0,
            "create": 1754846400,
            "delay": 0,
            "start": 1754846500,
            "finish": 1754849400
        },
        "1042": {
            "id": 1042,
            "acc": 666,
            "type": 4,
            "status": 1,
            "error": 0,
            "retry": 0,
            "create": 1754850000,
            "delay": 1754864400,
            "start": 0,
            "finish": 0
        },
        "1055": {
            "id": 1055,
            "acc": 671,
            "type": 4,
            "status": 4,
            "error": 902,
            "retry": 2,
            "create": 1754760000,
            "delay": 1754790000,
            "start": 1754789000,
            "finish": 1754789600
        }
    }
}

Errors

CodeDescription
bad-idNo account with this ID is found.
unpaidSubscription not paid.
Back to contents

03 Adding a task

URLhttps://ggl.farm/api/task/add.json?id={apitoken}

Queues a task on an existing account. There are two task types: make2fa turns on two-factor authentication and login logs into the account. The robot runs the tasks in the order of the account queue. It works like the task buttons in the account card.

Parameters

FieldDescription
acc*Account ID in GGL.
type*Task type: make2fa or login.
delayAfter how many hours to run the task. Fractions are allowed, for example 2.5. Only make2fa takes it into account. A login task is always queued to run at once.

If an unfinished task of the same type is already in the account queue, the new one is not added.

Response

{ "status": "ok", "id": 1042 }

Errors

CodeDescription
no-idAccount ID is not specified.
bad-idNo account with this ID is found.
no-typeTask type is not specified.
bad-typeAn unavailable task type is specified.
duplicateAn unfinished task of this type is already in the account queue.
unpaidSubscription not paid.
Back to contents

04 Deleting a task

URLhttps://ggl.farm/api/task/del.json?id={apitoken}&task={id}

Removes a task from the account queue and releases the task that follows it.

Parameters

FieldDescription
task*Task ID in GGL.

System registration tasks cannot be deleted. Successfully completed tasks are not deleted either. They stay in the account history.

Response

{ "status": "ok" }

Errors

CodeDescription
no-idTask ID is not specified.
bad-idNo task with this ID is found.
systemA system registration task cannot be deleted.
bad-statusA task with this status cannot be deleted.
unpaidSubscription not paid.
Back to contents

05 Restarting a task

URLhttps://ggl.farm/api/task/restart.json?id={apitoken}&task={id}

Returns a task to the execution queue. Only tasks with the “Problem” and “Error” status are restarted. Such a task gets the “Waiting” status and the re-launch counter goes up.

Parameters

FieldDescription
task*Task ID in GGL.

Before restarting, remove the cause of the failure, for example, replace a proxy that does not work.

Response

{ "status": "ok" }

Errors

CodeDescription
no-idTask ID is not specified.
bad-idNo task with this ID is found.
bad-statusA task with this status cannot be restarted. Only “Problem” and “Error” tasks are restarted.
unpaidSubscription not paid.
Back to contents