-
Notifications
You must be signed in to change notification settings - Fork 99
Public API
- Overview
- API
- Extending The API
- Notable Projects Using The API
This document describes the resources that make up FreeSO's public API. It is currently in beta and subject to change at any time.
The live server API, api.freeso.org
can be accessed via HTTP or HTTPS. You should use HTTPS to access the live server API unless absolutely necessary. This documentation will include examples using the live server, but if you are building and testing new API features in a dev build, just replace api.freeso.org
with whatever your API URL is (ex. localhost:9000/userapi/city/1/city.json
).
Feel free to update missing/incorrect information by editing this page.
For more information about some of the data returned by the API, please see Public API Data Definitions
/userapi/city/{shardId}/avatars/page/{pageNum}?avatars_on_page={avatarsPerPage}
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
pageNum |
integer |
The page of avatars you'd like to request. pageNum 1 will give you the total number of pages. |
avatarsPerPage |
integer (Optional) |
The number of avatars to return per page. Default is 100 , max is 500 . |
{
"page": 1,
"total_pages": 1,
"total_avatars": 1,
"avatars_on_page": 1,
"avatars": [
{
"avatar_id": 887,
"shard_id": 1,
"name": "burglar cop",
"gender": 0,
"date": 1486420929,
"description": " the law is a suggestion\r\n but its a pretty good one tbh\r\n\r\n -me\r\n\r\ndont freak out if im just standing there starving im probably developing something worth dying for\r\n",
"current_job": 5,
"mayor_nhood": null
}
]
}
https://api.freeso.org/userapi/city/1/avatars/page/1
/userapi/city/{shardId}/avatars/neighborhood/{nhoodId}
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
nhoodId |
integer |
The value of neighborhood_id in fso_neighborhoods for a neighborhood. |
{
"avatars": [
{
"avatar_id": 887,
"shard_id": 1,
"name": "burglar cop",
"gender": 0,
"date": 1486420929,
"description": " the law is a suggestion\r\n but its a pretty good one tbh\r\n\r\n -me\r\n\r\ndont freak out if im just standing there starving im probably developing something worth dying for\r\n",
"current_job": 5,
"mayor_nhood": null
}
]
}
https://api.freeso.org/userapi/city/1/avatars/neighborhood/54
/userapi/avatars/online?compact={compactBool}
Name | Type | Description |
---|---|---|
compact |
boolean (Optional) |
Compact returns avatars_online_count and an empty avatars array. Default is false. |
{
"avatars_online_count": 1,
"avatars": [
{
"avatar_id": 1,
"name": "burglar cop",
"privacy_mode": 0,
"location": 13828398
}
]
}
https://api.freeso.org/userapi/avatars/online
/userapi/avatars/?ids={avatarIds}
Name | Type | Description |
---|---|---|
avatarIds |
string |
A list of avatar_id s from fso_avatars separated by commas. |
{
"avatars": [
{
"avatar_id": 887,
"shard_id": 1,
"name": "burglar cop",
"gender": 0,
"date": 1486420929,
"description": " the law is a suggestion\n but its a pretty good one tbh\r\n\r\n -me\r\n\ndont freak out if im just standing there starving im probably developing something worth dying for\n",
"current_job": 5,
"mayor_nhood": null
}
]
}
https://api.freeso.org/userapi/avatars?ids=887,30363
/userapi/user/avatars
Returns an array of the avatars associated with a User ID. Requires a valid token for authorization.
{
"avatars": [
{
"avatar_id": 887,
"shard_id": 1,
"name": "burglar cop",
"gender": 0,
"date": 1486420929,
"description": " the law is a suggestion\n but its a pretty good one tbh\r\n\r\n -me\r\n\ndont freak out if im just standing there starving im probably developing something worth dying for\n",
"current_job": 5,
"mayor_nhood": null
}
]
}
Send a GET request using something like Postman with an authorization header of type bearer token and a valid token to https://api.freeso.org/userapi/user/avatars
/userapi/avatars/{avatarId}
Name | Type | Description |
---|---|---|
avatarId |
integer |
The value of avatar_id in fso_avatars for an avatar. |
{
"avatar_id": 887,
"shard_id": 1,
"name": "burglar cop",
"gender": 0,
"date": 1486420929,
"description": " the law is a suggestion\r\n but its a pretty good one tbh\r\n\r\n -me\r\n\r\ndont freak out if im just standing there starving im probably developing something worth dying for\r\n",
"current_job": 5,
"mayor_nhood": null
}
https://api.freeso.org/userapi/avatars/887
/userapi/city/{shardId}/avatars/name/{avatarName}
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
avatarName |
string |
The value of name in fso_avatars for an avatar. Warning: Make sure this string is URL encoded
|
{
"avatar_id": 887,
"shard_id": 1,
"name": "burglar cop",
"gender": 0,
"date": 1486420929,
"description": " the law is a suggestion\r\n but its a pretty good one tbh\r\n\r\n -me\r\n\r\ndont freak out if im just standing there starving im probably developing something worth dying for\r\n",
"current_job": 5,
"mayor_nhood": null
}
https://api.freeso.org/userapi/city/1/avatars/name/burglar%20cop
/userapi/city/{shardId}/lots/page/{pageNum}?lots_on_page={lotsPerPage}
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
pageNum |
integer |
The page of lots you'd like to request. pageNum 1 will give you the total number of pages. |
lotsPerPage |
integer (Optional) |
The number of lots to return per page. Default is 100 , max is 500 . |
{
"page": 1,
"total_pages": 1,
"total_lots": 1,
"lots_on_page": 1,
"lots": [
{
"lot_id": 6852,
"location": 13828398,
"name": "M.O.M.I. Headquarters",
"description": "",
"category": 5,
"admit_mode": 3,
"neighborhood_id": 54,
"avatars_in_lot": 0
}
]
}
https://api.freeso.org/userapi/city/1/lots/page/1
/userapi/city/{shardId}/lots/neighborhood/{nhoodId}
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
nhoodId |
integer |
The value of neighborhood_id in fso_neighborhoods for a neighborhood. |
{
"lots": [
{
"lot_id": 6852,
"location": 13828398,
"name": "M.O.M.I. Headquarters",
"description": "",
"category": 5,
"admit_mode": 3,
"neighborhood_id": 54,
"avatars_in_lot": 0
}
]
}
https://api.freeso.org/userapi/city/1/lots/neighborhood/54
/userapi/city/{shardId}/lots/online?compact={compactBool}
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
compactBool |
boolean (Optional) |
Compact returns total_lots_online , total_avatars_in_lots_online and an empty lots array. Default is false. |
{
"total_lots_online": 1,
"total_avatars_in_lots_online": 1,
"lots": [
{
"location": 13828398,
"name": "M.O.M.I. Headquarters",
"description": "",
"category": 5,
"neighborhood_id": 54,
"avatars_in_lot": 0
}
]
}
https://api.freeso.org/userapi/city/1/lots/online
/userapi/lots?ids={lotIds}
Name | Type | Description |
---|---|---|
lotIds |
string |
A list of lot_id s from fso_lots separated by commas. |
{
"lots": [
{
"lot_id": 6852,
"shard_id": 1,
"owner_id": 887,
"roommates": [
887
],
"location": 13828398,
"name": "M.O.M.I. Headquarters",
"description": "",
"location": 13828398,
"neighborhood_id": 54,
"created_date": 1518961270,
"category": 5,
"skill_mode": 0,
"admit_mode": 1
}
]
}
https://api.freeso.org/userapi/lots?ids=6852,6634
/userapi/lots/{lotId}
Name | Type | Description |
---|---|---|
lotId |
integer |
The value of lot_id in fso_lots for a lot. |
{
"lot_id": 6852,
"shard_id": 1,
"owner_id": 887,
"roommates": [
887
],
"name": "M.O.M.I. Headquarters",
"description": "",
"location": 13828398,
"neighborhood_id": 54,
"created_date": 1518961270,
"category": 5,
"skill_mode": 0,
"admit_mode": 1
}
https://api.freeso.org/userapi/lots/6852
/userapi/city/{shardId}/lots/location/{locationId}
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
locationId |
integer |
The value of location in fso_lots for a lot. |
{
"lot_id": 6852,
"shard_id": 1,
"owner_id": 887,
"roommates": [
887
],
"name": "M.O.M.I. Headquarters",
"description": "",
"location": 13828398,
"neighborhood_id": 54,
"created_date": 1518961270,
"category": 5,
"skill_mode": 0,
"admit_mode": 1
}
https://api.freeso.org/userapi/city/1/lots/location/13828398
/userapi/city/{shardId}/lots/name/{lotName}
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
lotName |
string |
The value of name in fso_lots for a lot. Warning: Make sure this string is URL encoded
|
{
"lot_id": 6852,
"shard_id": 1,
"owner_id": 887,
"roommates": [
887
],
"name": "M.O.M.I. Headquarters",
"description": "",
"location": 13828398,
"neighborhood_id": 54,
"created_date": 1518961270,
"category": 5,
"skill_mode": 0,
"admit_mode": 1
}
https://api.freeso.org/userapi/city/1/lots/name/M.O.M.I.%20Headquarters
/userapi/city/{shardId}/lots/top100/all
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
{
"lots": [
{
"category": 5,
"rank": 1,
"shard_id": 1,
"lot_name": "M.O.M.I. Headquarters",
"lot_location": 13828398,
"lot_id": 6852
}
]
}
https://api.freeso.org/userapi/city/1/lots/top100/all
/userapi/city/{shardId}/lots/top100/category/{lotCategory}
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
lotCategory |
integer |
The category type (1-11) |
{
"lots": [
{
"category": 5,
"rank": 1,
"shard_id": 1,
"lot_name": "M.O.M.I. Headquarters",
"lot_location": 13828398,
"lot_id": 6852
}
]
}
https://api.freeso.org/userapi/city/1/lots/top100/category/5
/userapi/city/{shardId}/neighborhoods/all
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
{
"neighborhoods": [
{
"neighborhood_id": 54,
"name": "D.A.M.N.",
"description": "Fully known as the D.A.D.D.I. And M.O.M.I. Neighborhood. The home of the Sunrise Crater government, who have the final say over all decisions and neighborhoods despite never being elected.\r\n\r\nFamous for its huge annual events, incredibly high rate of arson and non-existent firefighter response, this location has a higher mortality rate for visitors than any other mountain on the planet.",
"color": 0,
"town_hall_id": 6634,
"icon_url": null,
"mayor_id": 108523,
"mayor_elected_date": 1565012163,
"election_cycle_id": null
}
]
}
https://api.freeso.org/userapi/city/1/neighborhoods/all
/userapi/neighborhoods/{nhoodId}
Name | Type | Description |
---|---|---|
nhoodId |
integer |
The value of neighborhood_id in fso_neighborhoods for a neighborhood. |
{
"neighborhood_id": 54,
"name": "D.A.M.N.",
"description": "Fully known as the D.A.D.D.I. And M.O.M.I. Neighborhood. The home of the Sunrise Crater government, who have the final say over all decisions and neighborhoods despite never being elected.\r\n\r\nFamous for its huge annual events, incredibly high rate of arson and non-existent firefighter response, this location has a higher mortality rate for visitors than any other mountain on the planet.",
"color": 0,
"town_hall_id": 6634,
"icon_url": null,
"mayor_id": 108523,
"mayor_elected_date": 1565012163,
"election_cycle_id": null
}
https://api.freeso.org/userapi/neighborhoods/54
/userapi/neighborhoods/{nhoodName}
Name | Type | Description |
---|---|---|
nhoodName |
string |
The value of name in fso_neighborhoods for a neighborhood. Warning: Make sure this string is URL encoded
|
{
"neighborhood_id": 54,
"name": "D.A.M.N.",
"description": "Fully known as the D.A.D.D.I. And M.O.M.I. Neighborhood. The home of the Sunrise Crater government, who have the final say over all decisions and neighborhoods despite never being elected.\r\n\r\nFamous for its huge annual events, incredibly high rate of arson and non-existent firefighter response, this location has a higher mortality rate for visitors than any other mountain on the planet.",
"color": 0,
"town_hall_id": 6634,
"icon_url": null,
"mayor_id": 108523,
"mayor_elected_date": 1565012163,
"election_cycle_id": null
}
https://api.freeso.org/userapi/neighborhoods/D.A.M.N.
/userapi/neighborhood/{nhoodId}/bulletins
Name | Type | Description |
---|---|---|
nhoodId |
integer |
The value of neighborhood_id in fso_neighborhoods for a neighborhood. |
{
"bulletins": [
{
"bulletin_id": 241,
"neighborhood_id": 54,
"avatar_id": 887,
"title": "Why are we still here?",
"body": "Just to Suffer?",
"date": 1561318161,
"flags": 0,
"lot_id": 13828399,
"type": 0
}
]
}
https://api.freeso.org/userapi/neighborhood/54/bulletins
/userapi/neighborhood/{nhoodId}/bulletins/type/{bulletinType}
Name | Type | Description |
---|---|---|
nhoodId |
integer |
The value of neighborhood_id in fso_neighborhoods for a neighborhood. |
bulletinType |
integer |
0 - Mayor posts, 1 - System messages, 2 - Community posts. Warning: System messages may reference game assets instead of providing a human readable bulletin.
|
{
"bulletins": [
{
"bulletin_id": 241,
"neighborhood_id": 54,
"avatar_id": 887,
"title": "Why are we still here?",
"body": "Just to Suffer?",
"date": 1561318161,
"flags": 0,
"lot_id": 13828399,
"type": 0
}
]
}
https://api.freeso.org/userapi/neighborhood/1/bulletins/type/0
/userapi/neighborhood/{nhoodId}/bulletins/{bulletinId}
Name | Type | Description |
---|---|---|
nhoodId |
integer |
The value of neighborhood_id in fso_neighborhoods for a neighborhood. |
bulletinId |
integer |
The value of bulletin_id in fso_bulletin_posts for a bulletin. |
{
"bulletin_id": 241,
"neighborhood_id": 54,
"avatar_id": 887,
"title": "Why are we still here?",
"body": "Just to Suffer?",
"date": 1561318161,
"flags": 0,
"lot_id": 13828399,
"type": 0
}
https://api.freeso.org/userapi/neighborhood/54/bulletins/241
/userapi/neighborhood/{nhoodId}/elections
Name | Type | Description |
---|---|---|
nhoodId |
integer |
The value of neighborhood_id in fso_neighborhoods for a neighborhood. |
{
"current_state": 1,
"neighborhood_id": 54,
"start_date": 1565630999,
"end_date": 1566062999,
"candidates": []
}
{
"error": "Election cycle not found"
}
https://api.freeso.org/userapi/neighborhood/54/elections
/userapi/oauth/token
Warning: Access to this endpoint may be restricted by URL/IP at any time.
Name | Type | Description |
---|---|---|
username |
string |
The value of neighborhood_id in fso_neighborhoods for a neighborhood. |
password |
string |
The value of neighborhood_id in fso_neighborhoods for a neighborhood. |
permission_level |
integer |
The level of account access requested for the token (1-4). 1 - Read, 2 - Update, 3 - Write, 4 - Delete |
{
"access_token": "ROoPRE007bqYBABGylS3TJREv8kOh49E6z7Qa2wXBryCxcRn8NFWrV48SNTKVL1K7wkwAEsqeKMHoIi6F4WOkZYUiKZ8ar0II3JqOZB9db3rgfHpZELcYvsCNM0CBy4pIaofhnoj2qI4JVy7mq27i9O0ZiIMLB9JLksxsmMAMefm8482VU5RjhDQRX16jFNjoEK8Rtb3rBJq340LCeAA9XOgnisG4iwjeaK1zjgU93i8VCe1GTpCowS5C9UX2",
"expires_in": 3600
}
Send a form-data
POST containing the parameters using something like Postman to https://api.freeso.org/userapi/oauth/token
/userapi/city/{shardId}/city.json
Returns every reserved lot, its name, online lots, and all online lot's populations.
Warning: This endpoint may be deprecated in favor of recent API additions. You should migrate existing projects to use them.
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
Name | Type | Description |
---|---|---|
names |
array[string] |
An array of every lot name in alphabetical order. |
reservedLots |
array[integer] |
An array of every reserved lot's location (the index matches up with the names array). |
activeLots |
array[integer] |
An array of lot locations for lots that are open. |
onlineCount |
array[integer] |
An array of lot population for lots that are open (the index matches up with the activeLots array). |
{
"names": [
"Sunrise Crater Town Hall",
"M.O.M.I. Headquarters"
],
"reservedLots": [
13828397,
13828398
],
"activeLots": [
13828397
],
"onlineCount": [
10
]
}
https://api.freeso.org/userapi/city/1/city.json
/userapi/city/{shardId}/{lotLocation}.png
Name | Type | Description |
---|---|---|
shardId |
integer |
The value of shard_id in fso_shards for a city. This will likely always be 1 . |
lotLocation |
integer |
The location of a reserved lot. |
https://api.freeso.org/userapi/city/1/13828398.png
If the API is missing some data you think would be beneficial, you can open an issue to discuss it, but the best solution would be to submit a pull request yourself. This PR by @Cowplant-Simmer-Collin is a great example of how to add new API features.
The following are popular projects known to consume the API. They should be notified of any breaking changes. Feel free to add your own to this list.
- TSOMania
- FreeSO Dashboard @dotequals
- FreeSO Notifier - Nebulae#0666