Docs

Avatars API


Client 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 image 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.

When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.

HTTP 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.

HTTP Response

Status Code Content Type Payload
200  OK image/png -
Example Request
  • import { Client, Avatars } from "appwrite";
    
    const client = new Client();
    
    const avatars = new Avatars(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const result = avatars.getCreditCard('amex');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      // downloading file
      Future result = avatars.getCreditCard(
        code: 'amex',
      ).then((bytes) {
        final file = File('path_to_file/filename.ext');
        file.writeAsBytesSync(bytes)
      }).catchError((error) {
          print(error.response);
      })
    }
    
    //displaying image preview
    FutureBuilder(
      future: avatars.getCreditCard(
        code: 'amex',
      ), //works for both public file and private file, for private files you need to be logged in
      builder: (context, snapshot) {
        return snapshot.hasData && snapshot.data != null
          ? Image.memory(
              snapshot.data,
            )
          : CircularProgressIndicator();
      },
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let avatars = Avatars(client)
    
    let byteBuffer = try await avatars.getCreditCard(
        code: "amex"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val avatars = Avatars(client)
    
    val result = avatars.getCreditCard(
        code = "amex",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Avatars;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Avatars avatars = new Avatars(client);
    
    avatars.getCreditCard(
        "amex",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • query {
        avatarsGetCreditCard(
            code: "amex"
        ) {
            status
        }
    }
    
  • GET /v1/avatars/credit-cards/{code} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

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 GET /account/sessions endpoint. Use width, height and quality arguments to change the output settings.

When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.

HTTP 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.

HTTP Response

Status Code Content Type Payload
200  OK image/png -
Example Request
  • import { Client, Avatars } from "appwrite";
    
    const client = new Client();
    
    const avatars = new Avatars(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const result = avatars.getBrowser('aa');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      // downloading file
      Future result = avatars.getBrowser(
        code: 'aa',
      ).then((bytes) {
        final file = File('path_to_file/filename.ext');
        file.writeAsBytesSync(bytes)
      }).catchError((error) {
          print(error.response);
      })
    }
    
    //displaying image preview
    FutureBuilder(
      future: avatars.getBrowser(
        code: 'aa',
      ), //works for both public file and private file, for private files you need to be logged in
      builder: (context, snapshot) {
        return snapshot.hasData && snapshot.data != null
          ? Image.memory(
              snapshot.data,
            )
          : CircularProgressIndicator();
      },
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let avatars = Avatars(client)
    
    let byteBuffer = try await avatars.getBrowser(
        code: "aa"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val avatars = Avatars(client)
    
    val result = avatars.getBrowser(
        code = "aa",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Avatars;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Avatars avatars = new Avatars(client);
    
    avatars.getBrowser(
        "aa",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • query {
        avatarsGetBrowser(
            code: "aa"
        ) {
            status
        }
    }
    
  • GET /v1/avatars/browsers/{code} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

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. Country codes follow the ISO 3166-1 standard.

When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.

HTTP 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.

HTTP Response

Status Code Content Type Payload
200  OK image/png -
Example Request
  • import { Client, Avatars } from "appwrite";
    
    const client = new Client();
    
    const avatars = new Avatars(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const result = avatars.getFlag('af');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      // downloading file
      Future result = avatars.getFlag(
        code: 'af',
      ).then((bytes) {
        final file = File('path_to_file/filename.ext');
        file.writeAsBytesSync(bytes)
      }).catchError((error) {
          print(error.response);
      })
    }
    
    //displaying image preview
    FutureBuilder(
      future: avatars.getFlag(
        code: 'af',
      ), //works for both public file and private file, for private files you need to be logged in
      builder: (context, snapshot) {
        return snapshot.hasData && snapshot.data != null
          ? Image.memory(
              snapshot.data,
            )
          : CircularProgressIndicator();
      },
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let avatars = Avatars(client)
    
    let byteBuffer = try await avatars.getFlag(
        code: "af"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val avatars = Avatars(client)
    
    val result = avatars.getFlag(
        code = "af",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Avatars;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Avatars avatars = new Avatars(client);
    
    avatars.getFlag(
        "af",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • query {
        avatarsGetFlag(
            code: "af"
        ) {
            status
        }
    }
    
  • GET /v1/avatars/flags/{code} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

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.

When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px.

HTTP 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. Defaults to 400.

height optional integer

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

HTTP Response

Status Code Content Type Payload
200  OK image/* -
Example Request
  • import { Client, Avatars } from "appwrite";
    
    const client = new Client();
    
    const avatars = new Avatars(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const result = avatars.getImage('https://example.com');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      // downloading file
      Future result = avatars.getImage(
        url: 'https://example.com',
      ).then((bytes) {
        final file = File('path_to_file/filename.ext');
        file.writeAsBytesSync(bytes)
      }).catchError((error) {
          print(error.response);
      })
    }
    
    //displaying image preview
    FutureBuilder(
      future: avatars.getImage(
        url: 'https://example.com',
      ), //works for both public file and private file, for private files you need to be logged in
      builder: (context, snapshot) {
        return snapshot.hasData && snapshot.data != null
          ? Image.memory(
              snapshot.data,
            )
          : CircularProgressIndicator();
      },
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let avatars = Avatars(client)
    
    let byteBuffer = try await avatars.getImage(
        url: "https://example.com"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val avatars = Avatars(client)
    
    val result = avatars.getImage(
        url = "https://example.com",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Avatars;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Avatars avatars = new Avatars(client);
    
    avatars.getImage(
        "https://example.com",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • query {
        avatarsGetImage(
            url: "https://example.com"
        ) {
            status
        }
    }
    
  • GET /v1/avatars/image HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Get Favicon

GET/v1/avatars/favicon

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

HTTP Request

Name Type Description
url required string

Website URL which you want to fetch the favicon from.

HTTP Response

Status Code Content Type Payload
200  OK image/* -
Example Request
  • import { Client, Avatars } from "appwrite";
    
    const client = new Client();
    
    const avatars = new Avatars(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const result = avatars.getFavicon('https://example.com');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      // downloading file
      Future result = avatars.getFavicon(
        url: 'https://example.com',
      ).then((bytes) {
        final file = File('path_to_file/filename.ext');
        file.writeAsBytesSync(bytes)
      }).catchError((error) {
          print(error.response);
      })
    }
    
    //displaying image preview
    FutureBuilder(
      future: avatars.getFavicon(
        url: 'https://example.com',
      ), //works for both public file and private file, for private files you need to be logged in
      builder: (context, snapshot) {
        return snapshot.hasData && snapshot.data != null
          ? Image.memory(
              snapshot.data,
            )
          : CircularProgressIndicator();
      },
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let avatars = Avatars(client)
    
    let byteBuffer = try await avatars.getFavicon(
        url: "https://example.com"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val avatars = Avatars(client)
    
    val result = avatars.getFavicon(
        url = "https://example.com"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Avatars;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Avatars avatars = new Avatars(client);
    
    avatars.getFavicon(
        "https://example.com"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • query {
        avatarsGetFavicon(
            url: "https://example.com"
        ) {
            status
        }
    }
    
  • GET /v1/avatars/favicon HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

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.

HTTP 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 1 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.

HTTP Response

Status Code Content Type Payload
200  OK image/png -
Example Request
  • import { Client, Avatars } from "appwrite";
    
    const client = new Client();
    
    const avatars = new Avatars(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const result = avatars.getQR('[TEXT]');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      // downloading file
      Future result = avatars.getQR(
        text: '[TEXT]',
      ).then((bytes) {
        final file = File('path_to_file/filename.ext');
        file.writeAsBytesSync(bytes)
      }).catchError((error) {
          print(error.response);
      })
    }
    
    //displaying image preview
    FutureBuilder(
      future: avatars.getQR(
        text: '[TEXT]',
      ), //works for both public file and private file, for private files you need to be logged in
      builder: (context, snapshot) {
        return snapshot.hasData && snapshot.data != null
          ? Image.memory(
              snapshot.data,
            )
          : CircularProgressIndicator();
      },
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let avatars = Avatars(client)
    
    let byteBuffer = try await avatars.getQR(
        text: "[TEXT]"
    )
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val avatars = Avatars(client)
    
    val result = avatars.getQR(
        text = "[TEXT]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Avatars;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Avatars avatars = new Avatars(client);
    
    avatars.getQR(
        "[TEXT]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • query {
        avatarsGetQR(
            text: "[TEXT]"
        ) {
            status
        }
    }
    
  • GET /v1/avatars/qr HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

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.

When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.

HTTP 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.

background optional string

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

HTTP Response

Status Code Content Type Payload
200  OK image/png -
Example Request
  • import { Client, Avatars } from "appwrite";
    
    const client = new Client();
    
    const avatars = new Avatars(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    const result = avatars.getInitials();
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
      // downloading file
      Future result = avatars.getInitials(
      ).then((bytes) {
        final file = File('path_to_file/filename.ext');
        file.writeAsBytesSync(bytes)
      }).catchError((error) {
          print(error.response);
      })
    }
    
    //displaying image preview
    FutureBuilder(
      future: avatars.getInitials(
      ), //works for both public file and private file, for private files you need to be logged in
      builder: (context, snapshot) {
        return snapshot.hasData && snapshot.data != null
          ? Image.memory(
              snapshot.data,
            )
          : CircularProgressIndicator();
      },
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    let avatars = Avatars(client)
    
    let byteBuffer = try await avatars.getInitials()
    
    
  • import io.appwrite.Client
    import io.appwrite.services.Avatars
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
    
    val avatars = Avatars(client)
    
    val result = avatars.getInitials(
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Avatars;
    
    Client client = new Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2"); // Your project ID
    
    Avatars avatars = new Avatars(client);
    
    avatars.getInitials(
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            Log.d("Appwrite", result.toString());
        })
    );
    
  • query {
        avatarsGetInitials {
            status
        }
    }
    
  • GET /v1/avatars/initials HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...