Altar is a tiny API for the generation of identicons (Wikipedia). Altar always generates the same image from the same input through hashing and simple calculations.
This means that you can use Altar to generate profile pictures for users based on their username, or any other unique identifier.
Altar was built from the ground up with few dependencies, but is inspired from GitHub's Identicons and minidenticons.
Due to its small size, Altar is very fast. Local Waiting / Local Time To First Byte times are usually between 3-4 ms.
- Locally – install Altar wherever Python is supported by cloning the repository, installing all dependencies with
pip install -r requirements.txt
and runningmain.py
- Cloud – run your own instance of Altar on Railway. Just click the button below and you'll be guided through the setup.
It is possible to restrict the access to your Altar instance. To do that, simply create a .env
file in the directory where Altar is and add API_KEY
as a variable.
If you're hosting Altar on Vercel, go to Settings → Environment Variables and add API_KEY
there. Choose a key for your Altar instance and set it as the value of the environment variable.
To make authenticated requests to Altar, use the x-api-key
HTTP header with the API_KEY
as the value.
An API request to Altar only requires the data you want to use to generate the identicon. There are overrides (e.g. for the file size and color) which can be found in the documentation.
GET https://altar.berrysauce.dev/generate?data=example
Altar currently has two public endpoints:
- Origin: https://altar.berrysauce.dev
- 🚀 CDN: https://altarcdn.berrysauce.dev
Note
As Altar always generates the same image based on your input, it's recommendet to use the CDN endpoint for better performance.
Warning
Altar is just a small project, therefore security cannot always be guaranteed. It's only recommended to pass on usernames or unique identifiers to Altar, which do not include or grant access to personal information.
Header | Type | Description | Required |
---|---|---|---|
x-api-key |
String | API Key for authentication, if it was set as an environment variable. | no (if set, yes |
Query | Type | Description | Required |
---|---|---|---|
data |
String | Data to be used for identicon generation | yes |
color |
String | HEX Color to be used for the identicon foreground without '#' (default: generated based on input) | no |
background |
String | HEX Color to be used for the identicon background without '#' prefix (default: none/transparent) | no |
size |
Integer | Width & Height of the scaled SVG (default: 250) | no |
padding |
Integer | Padding for the identicon (default: 0) | no |
- Install Altar wherever Python is supported by cloning the repository
- Install all dependencies with
pip install -r requirements.txt
- Run
main.py
withpython main.py
Note
Altar is built with Python 3.9.x, but should work with any Python version above 3.6
Altar is licensed under the MIT license.
Copyright (c) 2023 Paul Haedrich
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: