We've raised a $10M seed round! 🚀
Docs

Avatars API


Server integration with  

The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars.

The Avatars service allows you to fetch country flags, browser icons, payment methods logos, remote websites favicons, generate QR codes, and manipulate remote images URLs.

All endpoints in this service allow you to resize, crop, and change the output image quality for maximum performance and visibility in your app.

Get Credit Card Icon

GET/v1/avatars/credit-cards/{code}

The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "avatars.read" permission scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Request

Name Type Description
code required string

Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.

width optional integer

Image width. Pass an integer between 0 to 2000. Defaults to 100.

height optional integer

Image height. Pass an integer between 0 to 2000. Defaults to 100.

quality optional integer

Image quality. Pass an integer between 0 to 100. Defaults to 100.

Response

Status Code Content Type Payload
200  OK image/png -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    let promise = avatars.getCreditCard('amex');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = avatars.getCreditCard('amex');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Avatars;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $avatars = new Avatars($client);
    
    $result = $avatars->getCreditCard('amex');
  • from appwrite.client import Client
    from appwrite.services.avatars import Avatars
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    avatars = Avatars(client)
    
    result = avatars.get_credit_card('amex')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    client
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    ;
    
    avatars = Appwrite::Avatars.new(client);
    
    response = avatars.get_credit_card(code: 'amex');
    
    puts response
  • using Appwrite;
    
    Client client = new Client();
    
    client
      .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
      .SetProject("5df5acd0d48c2") // Your project ID
      .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    ;
    
    Avatars avatars = new Avatars(client);
    
    string result = await avatars.GetCreditCard("amex");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = avatars.getCreditCard(
        code: 'amex',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite avatars getCreditCard \
            --code="amex" \
            --width="0" \
            --height="0" \
            --quality="0"
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    suspend fun main() {
        val client = Client(context)
          .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
          .setProject("5df5acd0d48c2") // Your project ID
          .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
        val avatars = Avatars(client)
        val result = avatars.getCreditCard(
            code = "amex",
        )
        println(result); // Resource URL
    }
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Avatars avatars = new Avatars(client);
        avatars.getCreditCard(
            code = "amex",
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Get Browser Icon

GET/v1/avatars/browsers/{code}

You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user /account/sessions endpoint. Use width, height and quality arguments to change the output settings.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "avatars.read" permission scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Request

Name Type Description
code required string

Browser Code.

width optional integer

Image width. Pass an integer between 0 to 2000. Defaults to 100.

height optional integer

Image height. Pass an integer between 0 to 2000. Defaults to 100.

quality optional integer

Image quality. Pass an integer between 0 to 100. Defaults to 100.

Response

Status Code Content Type Payload
200  OK image/png -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    let promise = avatars.getBrowser('aa');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = avatars.getBrowser('aa');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Avatars;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $avatars = new Avatars($client);
    
    $result = $avatars->getBrowser('aa');
  • from appwrite.client import Client
    from appwrite.services.avatars import Avatars
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    avatars = Avatars(client)
    
    result = avatars.get_browser('aa')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    client
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    ;
    
    avatars = Appwrite::Avatars.new(client);
    
    response = avatars.get_browser(code: 'aa');
    
    puts response
  • using Appwrite;
    
    Client client = new Client();
    
    client
      .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
      .SetProject("5df5acd0d48c2") // Your project ID
      .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    ;
    
    Avatars avatars = new Avatars(client);
    
    string result = await avatars.GetBrowser("aa");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = avatars.getBrowser(
        code: 'aa',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite avatars getBrowser \
            --code="aa" \
            --width="0" \
            --height="0" \
            --quality="0"
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    suspend fun main() {
        val client = Client(context)
          .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
          .setProject("5df5acd0d48c2") // Your project ID
          .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
        val avatars = Avatars(client)
        val result = avatars.getBrowser(
            code = "aa",
        )
        println(result); // Resource URL
    }
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Avatars avatars = new Avatars(client);
        avatars.getBrowser(
            code = "aa",
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Get Country Flag

GET/v1/avatars/flags/{code}

You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "avatars.read" permission scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Request

Name Type Description
code required string

Country Code. ISO Alpha-2 country code format.

width optional integer

Image width. Pass an integer between 0 to 2000. Defaults to 100.

height optional integer

Image height. Pass an integer between 0 to 2000. Defaults to 100.

quality optional integer

Image quality. Pass an integer between 0 to 100. Defaults to 100.

Response

Status Code Content Type Payload
200  OK image/png -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    let promise = avatars.getFlag('af');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = avatars.getFlag('af');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Avatars;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $avatars = new Avatars($client);
    
    $result = $avatars->getFlag('af');
  • from appwrite.client import Client
    from appwrite.services.avatars import Avatars
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    avatars = Avatars(client)
    
    result = avatars.get_flag('af')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    client
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    ;
    
    avatars = Appwrite::Avatars.new(client);
    
    response = avatars.get_flag(code: 'af');
    
    puts response
  • using Appwrite;
    
    Client client = new Client();
    
    client
      .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
      .SetProject("5df5acd0d48c2") // Your project ID
      .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    ;
    
    Avatars avatars = new Avatars(client);
    
    string result = await avatars.GetFlag("af");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = avatars.getFlag(
        code: 'af',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite avatars getFlag \
            --code="af" \
            --width="0" \
            --height="0" \
            --quality="0"
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    suspend fun main() {
        val client = Client(context)
          .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
          .setProject("5df5acd0d48c2") // Your project ID
          .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
        val avatars = Avatars(client)
        val result = avatars.getFlag(
            code = "af",
        )
        println(result); // Resource URL
    }
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Avatars avatars = new Avatars(client);
        avatars.getFlag(
            code = "af",
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Get Image from URL

GET/v1/avatars/image

Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "avatars.read" permission scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Request

Name Type Description
url required string

Image URL which you want to crop.

width optional integer

Resize preview image width, Pass an integer between 0 to 2000.

height optional integer

Resize preview image height, Pass an integer between 0 to 2000.

Response

Status Code Content Type Payload
200  OK image/* -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    let promise = avatars.getImage('https://example.com');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = avatars.getImage('https://example.com');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Avatars;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $avatars = new Avatars($client);
    
    $result = $avatars->getImage('https://example.com');
  • from appwrite.client import Client
    from appwrite.services.avatars import Avatars
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    avatars = Avatars(client)
    
    result = avatars.get_image('https://example.com')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    client
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    ;
    
    avatars = Appwrite::Avatars.new(client);
    
    response = avatars.get_image(url: 'https://example.com');
    
    puts response
  • using Appwrite;
    
    Client client = new Client();
    
    client
      .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
      .SetProject("5df5acd0d48c2") // Your project ID
      .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    ;
    
    Avatars avatars = new Avatars(client);
    
    string result = await avatars.GetImage("https://example.com");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = avatars.getImage(
        url: 'https://example.com',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite avatars getImage \
            --url="https://example.com" \
            --width="0" \
            --height="0"
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    suspend fun main() {
        val client = Client(context)
          .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
          .setProject("5df5acd0d48c2") // Your project ID
          .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
        val avatars = Avatars(client)
        val result = avatars.getImage(
            url = "https://example.com",
        )
        println(result); // Resource URL
    }
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Avatars avatars = new Avatars(client);
        avatars.getImage(
            url = "https://example.com",
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Get Favicon

GET/v1/avatars/favicon

Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "avatars.read" permission scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Request

Name Type Description
url required string

Website URL which you want to fetch the favicon from.

Response

Status Code Content Type Payload
200  OK image/* -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    let promise = avatars.getFavicon('https://example.com');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = avatars.getFavicon('https://example.com');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Avatars;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $avatars = new Avatars($client);
    
    $result = $avatars->getFavicon('https://example.com');
  • from appwrite.client import Client
    from appwrite.services.avatars import Avatars
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    avatars = Avatars(client)
    
    result = avatars.get_favicon('https://example.com')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    client
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    ;
    
    avatars = Appwrite::Avatars.new(client);
    
    response = avatars.get_favicon(url: 'https://example.com');
    
    puts response
  • using Appwrite;
    
    Client client = new Client();
    
    client
      .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
      .SetProject("5df5acd0d48c2") // Your project ID
      .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    ;
    
    Avatars avatars = new Avatars(client);
    
    string result = await avatars.GetFavicon("https://example.com");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = avatars.getFavicon(
        url: 'https://example.com',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite avatars getFavicon \
            --url="https://example.com"
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    suspend fun main() {
        val client = Client(context)
          .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
          .setProject("5df5acd0d48c2") // Your project ID
          .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
        val avatars = Avatars(client)
        val result = avatars.getFavicon(
            url = "https://example.com"
        )
        println(result); // Resource URL
    }
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Avatars avatars = new Avatars(client);
        avatars.getFavicon(
            url = "https://example.com"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Get QR Code

GET/v1/avatars/qr

Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "avatars.read" permission scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Request

Name Type Description
text required string

Plain text to be converted to QR code image.

size optional integer

QR code size. Pass an integer between 0 to 1000. Defaults to 400.

margin optional integer

Margin from edge. Pass an integer between 0 to 10. Defaults to 1.

download optional boolean

Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.

Response

Status Code Content Type Payload
200  OK image/png -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    let promise = avatars.getQR('[TEXT]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = avatars.getQR('[TEXT]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Avatars;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $avatars = new Avatars($client);
    
    $result = $avatars->getQR('[TEXT]');
  • from appwrite.client import Client
    from appwrite.services.avatars import Avatars
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    avatars = Avatars(client)
    
    result = avatars.get_qr('[TEXT]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    client
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    ;
    
    avatars = Appwrite::Avatars.new(client);
    
    response = avatars.get_qr(text: '[TEXT]');
    
    puts response
  • using Appwrite;
    
    Client client = new Client();
    
    client
      .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
      .SetProject("5df5acd0d48c2") // Your project ID
      .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    ;
    
    Avatars avatars = new Avatars(client);
    
    string result = await avatars.GetQR("[TEXT]");
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = avatars.getQR(
        text: '[TEXT]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite avatars getQR \
            --text="[TEXT]" \
            --size="0" \
            --margin="0" \
            --download=""
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    suspend fun main() {
        val client = Client(context)
          .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
          .setProject("5df5acd0d48c2") // Your project ID
          .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
        val avatars = Avatars(client)
        val result = avatars.getQR(
            text = "[TEXT]",
        )
        println(result); // Resource URL
    }
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Avatars avatars = new Avatars(client);
        avatars.getQR(
            text = "[TEXT]",
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }

Get User Initials

GET/v1/avatars/initials

Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.

You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "avatars.read" permission scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Request

Name Type Description
name optional string

Full Name. When empty, current user name or email will be used. Max length: 128 chars.

width optional integer

Image width. Pass an integer between 0 to 2000. Defaults to 100.

height optional integer

Image height. Pass an integer between 0 to 2000. Defaults to 100.

color optional string

Changes text color. By default a random color will be picked and stay will persistent to the given name.

background optional string

Changes background color. By default a random color will be picked and stay will persistent to the given name.

Response

Status Code Content Type Payload
200  OK image/png -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    let promise = avatars.getInitials();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let avatars = new sdk.Avatars(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = avatars.getInitials();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Avatars;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $avatars = new Avatars($client);
    
    $result = $avatars->getInitials();
  • from appwrite.client import Client
    from appwrite.services.avatars import Avatars
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    avatars = Avatars(client)
    
    result = avatars.get_initials()
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    client
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    ;
    
    avatars = Appwrite::Avatars.new(client);
    
    response = avatars.get_initials();
    
    puts response
  • using Appwrite;
    
    Client client = new Client();
    
    client
      .SetEndPoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
      .SetProject("5df5acd0d48c2") // Your project ID
      .SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    ;
    
    Avatars avatars = new Avatars(client);
    
    string result = await avatars.GetInitials();
    
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = avatars.getInitials(
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • appwrite avatars getInitials \
            --name="[NAME]" \
            --width="0" \
            --height="0" \
            --color="" \
            --background=""
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    suspend fun main() {
        val client = Client(context)
          .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
          .setProject("5df5acd0d48c2") // Your project ID
          .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
        val avatars = Avatars(client)
        val result = avatars.getInitials(
        )
        println(result); // Resource URL
    }
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    public void main() {
        Client client = Client(context)
            .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
            .setProject("5df5acd0d48c2") // Your project ID
            .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
        Avatars avatars = new Avatars(client);
        avatars.getInitials(
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }