Skip to content
v2.7

Get country flag

You can use this endpoint to show different country flags icons to your users.

GET/avatars/flags/{code}Scope avatars.read

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.

code Flag required

Country Code. ISO Alpha-2 country code format. Values: af, ao, al, ad, ae, ar, am, ag, au, at, az, bi, be, bj, bf, bd, bg, bh, bs, ba, by, bz, bo, br, bb, bn, bt, bw, cf, ca, ch, cl, cn, ci, cm, cd, cg, co, km, cv, cr, cu, cy, cz, de, dj, dm, dk, do, dz, ec, eg, er, es, ee, et, fi, fj, fr, fm, ga, gb, ge, gh, gn, gm, gw, gq, gr, gd, gt, gy, hn, hr, ht, hu, id, in, ie, ir, iq, is, il, it, jm, jo, jp, kz, ke, kg, kh, ki, kn, kr, kw, la, lb, lr, ly, lc, li, lk, ls, lt, lu, lv, ma, mc, md, mg, mv, mx, mh, mk, ml, mt, mm, me, mn, mz, mr, mu, mw, my, na, ne, ng, ni, nl, no, np, nr, nz, om, pk, pa, pe, ph, pw, pg, pl, pf, kp, pt, py, qa, ro, ru, rw, sa, sd, sn, sg, sb, sl, sv, sm, so, rs, ss, st, sr, sk, si, se, sz, sc, sy, td, tg, th, tj, tm, tl, to, tt, tn, tr, tv, tz, ug, ua, uy, us, uz, va, vc, ve, vn, vu, ws, ye, za, zm, zw.

width number

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

height number

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

quality number

Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.

Access: API key with the avatars.read scope or no key or session: the project ID is enough.

200Success
400Invalid or missing parameter
401No session, no permission on the resource or key without the scope
404Resource in the path not found
429Rate limit

Every error comes as JSON with code, type and message: see Errors.

import { Client, Avatars, Flag } from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const avatars = new Avatars(client);
const result = avatars.getFlag({
code: Flag.Afghanistan,
width: 0, // optional
height: 0, // optional
quality: -1, // optional
});
console.log(result);
Response200 OK

No response body.


The descriptions on this page come from the server API specification (BSD-3-Clause license), and the examples come from the SDK generator (MIT license). The full notices are in the NOTICE file of the @owbase/web and @owbase/node packages.

Was this page helpful?