Skip to content

Social Club API

Functions

Return Type Name Description
scapi_rockstar_account scapi.query(number rid) Queries a social club account by RID
scapi_account_pagination scapi.query(string name, number? page) Queries a social club account by name, with optional pagination
nil scapi.query_async(number rid, function callback(scapi_rockstar_account)) Same as above, only asynchronous
nil scapi.query_async(string name, function callback(scapi_account_pagination), number? page) Same as above, only asynchronous

Types

scapi_rockstar_account

Property Name
string name
number rid
bool success

scapi_result_info

Property Name
number total
number next_page
string query

scapi_account_pagination

Property Name Description
scapi_rockstar_account[] accounts List of accounts from this page
scapi_result_info paged Page info, used to query the next page
bool success Whether the query was successful

Examples

-- Querying all accounts with "Rockstar" in the name
function query_accounts(name, page)
  local scinfo = scapi.query(name, page)
  if scinfo.success then
    for i, account in ipairs(scinfo.accounts) do
      print('Name:', account.name)
    end

    if scinfo.paged.next_page > 0 then
      query_accounts(name, scinfo.paged.next_page)
    end
  end
end

query_accounts('Rockstar', 0)

-- Query an account by their rid
local scinfo = scapi.query(1)
if scinfo.success then
  print('Name:', scinfo.name)
end