Skip to Content
API ReferenceSocial Networks API

Social Networks API

Endpoints for managing social networks in the system.

Get list of social networks

Get the complete list of social networks.

Request

GET /api/social-networks

Headers

NameTypeDescription
X-API-KeystringRequired. API key

Query parameters

NameTypeDescription
pageintegerOptional. Page number (default: 1)
per_pageintegerOptional. Number of records per page (default: 20)

Response

{ "social_networks": [ { "id": 1, "key": "steam", "cooldown_time": 3600, "allow_to_register": true, "icon": "<svg>...</svg>", "enabled": true }, { "id": 2, "key": "discord", "cooldown_time": 7200, "allow_to_register": true, "icon": "<svg>...</svg>", "enabled": true } ] }

Response fields

FieldTypeDescription
social_networksarrayArray of social networks
idintegerSocial network ID
keystringSocial network key (identifier)
cooldown_timeintegerCooldown time between authorizations (in seconds)
allow_to_registerbooleanAllow registration through this social network
iconstringSocial network icon (SVG or image path)
enabledbooleanActivity status

Response codes

CodeDescription
200Successful request
401Invalid or missing API key
403Insufficient permissions for the request

Get social network data

Get detailed information about a specific social network.

Request

GET /api/social-networks/{id}

Path parameters

NameTypeDescription
idintegerSocial network ID

Headers

NameTypeDescription
X-API-KeystringRequired. API key

Response

{ "social_network": { "id": 1, "key": "steam", "cooldown_time": 3600, "allow_to_register": true, "icon": "<svg>...</svg>", "enabled": true, "settings": { "client_id": "your-client-id", "client_secret": "your-client-secret" }, "users_count": 157 } }

Response fields

FieldTypeDescription
social_networkobjectSocial network object
idintegerSocial network ID
keystringSocial network key (identifier)
cooldown_timeintegerCooldown time between authorizations (in seconds)
allow_to_registerbooleanAllow registration through this social network
iconstringSocial network icon (SVG or image path)
enabledbooleanActivity status
settingsobjectSettings for connecting to social network API
users_countintegerNumber of users using this social network

Response codes

CodeDescription
200Successful request
401Invalid or missing API key
403Insufficient permissions for the request
404Social network not found

Create social network

Create a new social network in the system.

Request

POST /api/social-networks

Headers

NameTypeDescription
X-API-KeystringRequired. API key
Content-TypestringRequired. application/json

Request body

{ "key": "vk", "settings": "{\"keys\":{\"client_id\":\"your-client-id\",\"client_secret\":\"your-client-secret\"}}", "cooldown_time": 3600, "allow_to_register": true, "icon": "<svg>...</svg>", "enabled": false }

Request body parameters

NameTypeDescription
keystringRequired. Social network key (identifier)
settingsstringRequired. JSON string with connection settings
cooldown_timeintegerOptional. Cooldown time between authorizations (sec)
allow_to_registerbooleanOptional. Allow registration through this social network
iconstringRequired. Social network icon
enabledbooleanOptional. Activity status

Response

{ "message": "Social network created successfully", "social_network": { "id": 3, "key": "vk", "cooldown_time": 3600, "allow_to_register": true, "icon": "<svg>...</svg>", "enabled": false } }

Response codes

CodeDescription
201Social network created successfully
401Invalid or missing API key
403Insufficient permissions for the request
422Invalid request parameters

Update social network

Update an existing social network.

Request

PUT /api/social-networks/{id}

Path parameters

NameTypeDescription
idintegerSocial network ID

Headers

NameTypeDescription
X-API-KeystringRequired. API key
Content-TypestringRequired. application/json

Request body

{ "key": "vk", "settings": "{\"keys\":{\"client_id\":\"updated-client-id\",\"client_secret\":\"updated-client-secret\"}}", "cooldown_time": 1800, "allow_to_register": true, "icon": "<svg>...</svg>", "enabled": true }

Request body parameters

NameTypeDescription
keystringRequired. Social network key (identifier)
settingsstringRequired. JSON string with connection settings
cooldown_timeintegerOptional. Cooldown time between authorizations (sec)
allow_to_registerbooleanOptional. Allow registration through this social network
iconstringRequired. Social network icon
enabledbooleanOptional. Activity status

Response

{ "message": "Social network updated successfully", "social_network": { "id": 3, "key": "vk", "cooldown_time": 1800, "allow_to_register": true, "icon": "<svg>...</svg>", "enabled": true } }

Response codes

CodeDescription
200Social network updated successfully
401Invalid or missing API key
403Insufficient permissions for the request
404Social network not found
422Invalid request parameters

Delete social network

Delete a social network from the system.

Request

DELETE /api/social-networks/{id}

Path parameters

NameTypeDescription
idintegerSocial network ID

Headers

NameTypeDescription
X-API-KeystringRequired. API key

Response

{ "message": "Social network deleted successfully" }

Response codes

CodeDescription
200Social network deleted successfully
401Invalid or missing API key
403Insufficient permissions for the request
404Social network not found
422Cannot delete, there are linked users

Get social network users

Get a list of users using a specific social network.

Request

GET /api/social-networks/{id}/users

Path parameters

NameTypeDescription
idintegerSocial network ID

Headers

NameTypeDescription
X-API-KeystringRequired. API key

Query parameters

NameTypeDescription
pageintegerOptional. Page number (default: 1)
per_pageintegerOptional. Number of records per page (default: 20)

Response

{ "users": [ { "id": 1, "name": "John Doe", "login": "john123", "value": "12345678", "url": "https://example.com/profile/12345678", "linked_at": "2023-01-01T10:30:00Z" }, { "id": 2, "name": "Jane Smith", "login": "jane456", "value": "87654321", "url": "https://example.com/profile/87654321", "linked_at": "2023-02-15T14:20:00Z" } ], "total": 157, "page": 1, "per_page": 20 }

Response fields

FieldTypeDescription
usersarrayArray of users
idintegerUser ID
namestringUser name
loginstringUser login
valuestringUser identifier in the social network
urlstringProfile URL in the social network
linked_atstringAccount linking date
totalintegerTotal number of users
pageintegerCurrent page
per_pageintegerNumber of records per page

Response codes

CodeDescription
200Successful request
401Invalid or missing API key
403Insufficient permissions for the request
404Social network not found

Toggle social network status

Enable or disable a social network.

Request

PATCH /api/social-networks/{id}/toggle

Path parameters

NameTypeDescription
idintegerSocial network ID

Headers

NameTypeDescription
X-API-KeystringRequired. API key

Response

{ "message": "Social network status updated successfully", "social_network": { "id": 1, "key": "steam", "cooldown_time": 3600, "allow_to_register": true, "icon": "<svg>...</svg>", "enabled": false } }

Response codes

CodeDescription
200Social network status updated successfully
401Invalid or missing API key
403Insufficient permissions for the request
404Social network not found

Get social network statistics

Get statistics for a specific social network.

Request

GET /api/social-networks/{id}/stats

Path parameters

NameTypeDescription
idintegerSocial network ID

Headers

NameTypeDescription
X-API-KeystringRequired. API key

Response

{ "stats": { "total_users": 157, "active_users": 142, "registrations_this_month": 23, "last_authorization": "2024-01-15T10:30:00Z" } }

Response fields

FieldTypeDescription
statsobjectStatistics object
total_usersintegerTotal number of users using this social network
active_usersintegerNumber of active users
registrations_this_monthintegerNumber of registrations this month
last_authorizationstringDate and time of last authorization (ISO 8601)

Response codes

CodeDescription
200Successful request
401Invalid or missing API key
403Insufficient permissions for the request
404Social network not found