Skip to content
Deviant edited this page Mar 17, 2024 · 11 revisions

API Usage Documentation:

Note

The API is currently free and I do not promise its stable operation.
If you want to support API development, go here: https://www.patreon.com/deviantapi

Main path:

https://starraillcard.up.railway.app/api/{method}

Method:

  1. card - generate character cards.
https://starraillcard.up.railway.app/api/card
  1. profile - get profile and profile card
https://starraillcard.up.railway.app/api/profile

Additional path:

https://starraillcard.up.railway.app/{method}

Method:

  1. get_profile - Will create/update data and return a link to the player's profile,
https://starraillcard.up.railway.app/get_profile
  1. profile - Link to user profile as a website. (Can be generated via the get_profile method)
https://starraillcard.up.railway.app/profile/{UID}

Params:

  1. Method card:

    • uid - UID of the player in the game.
    • lang - Language in which to generate cards.
    • template - Card design, only 2,3 and 4 available.
    • hide - Hide UID True/False.
    • id - characters id, as a string, separated by commas
    • image - Dictionary with custom images, where the key is the character ID, and the value is a link to the image.
  2. Method profile:

    • uid - UID of the player in the game.
    • lang - Language in which to generate cards.
  3. Method get_profile:

    • uid - UID of the player in the game.
    • lang - Language in which to generate cards.
    • template - Card design, only 2,3 and 4 available.
    • image - Dictionary with custom images, where the key is the character ID, and the value is a link to the image. (If you use a GET request, then it should be wrapped in a string)

Examples:

Python Requests
import requests

def main():
    url = "https://starraillcard.up.railway.app/api/card"
    headers = {'Content-Type': 'application/json'}

    data = {
        "uid": "You_UID",
        "lang": "ua",
        "name": "1208, 1205, 1112",
        "image": {"1302": "https://i.pximg.net/img-master/img/2023/06/20/16/53/28/109183352_p0_master1200.jpg"}
    }

    response = requests.post(url, json=data, headers=headers)

    if response.status_code == 200:
        data = response.json()
        if data.get("message") is None:
            print("Request successful")
            print(data)
        else:
            print("Request failed")
            print(data.get("message"))
    else:
        print(f"Request failed with status code {response.status_code}")

main()
Python AioHttp
import aiohttp
import asyncio

async def main():
    url = "https://starraillcard.up.railway.app/api/card"
    headers = {'Content-Type': 'application/json'}

    data = {
        "uid": "You_UID",
        "lang": "ua",
        "name": "1208, 1205, 1112",
        "image": {"1302": "https://i.pximg.net/img-master/img/2023/06/20/16/53/28/109183352_p0_master1200.jpg"}
    }

    async with aiohttp.ClientSession() as session:
        async with session.post(url, json=data, headers=headers) as response:
            if response.status == 200:
                data = await response.json()
                if data.get("message") is None:
                    print("Request successful")
                    print(data)
                else:
                    print("Request failed")
                    print(data.get("message"))
            else:
                print(f"Request failed with status code {response.status}")

asyncio.run(main())
NodeJS/JavaScript
const axios = require('axios');

async function main() {
    const url = "https://starraillcard.up.railway.app/api/card";
    const headers = {'Content-Type': 'application/json'};

    const data = {
        "uid": "YOU_UID",
        "lang": "ua",
        "name": "1208, 1205, 1112",
        "image": {"1302": "https://i.pximg.net/img-master/img/2023/06/20/16/53/28/109183352_p0_master1200.jpg"}
    };

    try {
        const response = await axios.post(url, data, {headers});

        if (response.status === 200) {
            const responseData = response.data;
            if (!responseData.message) {
                console.log("Request successful");
                console.log(responseData);
            } else {
                console.log("Request failed");
                console.log(responseData.message);
            }
        } else {
            console.log(`Request failed with status code ${response.status}`);
        }
    } catch (error) {
        console.error("Error during the request:", error.message);
    }
}

main();
C#
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        string url = "https://starraillcard.up.railway.app/api/card";
        string json = @"{
            ""uid"": ""Your_UID"",
            ""lang"": ""ua"",
            ""name"": ""1208, 1205, 1112"",
            ""image"": {
                ""1302"": ""https://i.pximg.net/img-master/img/2023/06/20/16/53/28/109183352_p0_master1200.jpg""
            }
        }";

        using (HttpClient client = new HttpClient())
        using (HttpContent content = new StringContent(json, Encoding.UTF8, "application/json"))
        using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url))
        {
            request.Content = content;

            HttpResponseMessage response = await client.SendAsync(request);

            if (response.IsSuccessStatusCode)
            {
                string responseData = await response.Content.ReadAsStringAsync();
                Console.WriteLine("Request successful");
                Console.WriteLine(responseData);
            }
            else
            {
                Console.WriteLine($"Request failed with status code {response.StatusCode}");
            }
        }
    }
}

Tip

  1. The API only supports POST requests.
  2. You can make up to 30 requests per minute.
  3. The result is returned in json format.
  4. The types of results are exactly the same as for module generation.
  5. The generated cards are returned in the form of links; they need to be saved as quickly as possible, otherwise the server may delete them over time or when the storage becomes full. [!WARNING] All the errors I processed were returned in json format and contain a message field, you can check for the presence of this key in the server response if its status is 200
Clone this wiki locally