@unavatar/core 3.45.12 → 3.45.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -83
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -151,20 +151,20 @@ Your attribution link:
|
|
|
151
151
|
Add this link on any page or surface displaying unavatar.io avatars:
|
|
152
152
|
|
|
153
153
|
```html
|
|
154
|
-
|
|
154
|
+
<ahref="https://unavatar.io">Avatars provided by Unavatar</a>
|
|
155
155
|
```
|
|
156
156
|
|
|
157
157
|
**Example**
|
|
158
158
|
|
|
159
159
|
```html
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
<imgsrc="https://unavatar.io/github/kikobeats"alt="Kiko"/>
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
<imgsrc="https://unavatar.io/x/josebaseba"alt="Joseba"/>
|
|
164
164
|
|
|
165
|
-
<
|
|
165
|
+
<pclass="attribution">
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
<ahref="https://unavatar.io">Avatars provided by Unavatar</a>
|
|
168
168
|
|
|
169
169
|
</p>
|
|
170
170
|
```
|
|
@@ -197,85 +197,85 @@ Anonymous requests work without authentication. They are limited to 25 requests/
|
|
|
197
197
|
For [PRO](https://unavatar.io/checkout) users, the requests must include the API key as the `x-api-key` request header:
|
|
198
198
|
|
|
199
199
|
```html
|
|
200
|
-
|
|
200
|
+
<imgsrc="https://unavatar.io/github/kikobeats"/>
|
|
201
201
|
```
|
|
202
202
|
|
|
203
203
|
```bash
|
|
204
|
-
curl
|
|
204
|
+
curl"https://unavatar.io/github/kikobeats"-H"x-api-key: YOUR_API_KEY"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
```javascript
|
|
208
|
-
|
|
208
|
+
awaitfetch('https://unavatar.io/github/kikobeats',{
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
headers:{
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
'x-api-key':'YOUR_API_KEY'
|
|
213
213
|
|
|
214
|
-
|
|
214
|
+
}
|
|
215
215
|
|
|
216
216
|
})
|
|
217
217
|
```
|
|
218
218
|
|
|
219
219
|
```python
|
|
220
|
-
|
|
220
|
+
importrequests
|
|
221
221
|
|
|
222
|
-
response
|
|
222
|
+
response=requests.get(
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
'https://unavatar.io/github/kikobeats',
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
headers={'x-api-key':'YOUR_API_KEY'}
|
|
227
227
|
|
|
228
228
|
)
|
|
229
229
|
```
|
|
230
230
|
|
|
231
231
|
```golang
|
|
232
|
-
|
|
232
|
+
packagemain
|
|
233
233
|
|
|
234
|
-
import
|
|
234
|
+
import"net/http"
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
funcmain(){
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
req,_:=http.NewRequest("GET","https://unavatar.io/github/kikobeats",nil)
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
req.Header.Set("x-api-key","YOUR_API_KEY")
|
|
241
241
|
|
|
242
|
-
|
|
242
|
+
resp,_:=http.DefaultClient.Do(req)
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
deferresp.Body.Close()
|
|
245
245
|
|
|
246
246
|
}
|
|
247
247
|
```
|
|
248
248
|
|
|
249
249
|
```ruby
|
|
250
|
-
require
|
|
250
|
+
require'net/http'
|
|
251
251
|
|
|
252
|
-
require
|
|
252
|
+
require'uri'
|
|
253
253
|
|
|
254
|
-
uri
|
|
254
|
+
uri=URI('https://unavatar.io/github/kikobeats')
|
|
255
255
|
|
|
256
|
-
request
|
|
256
|
+
request=Net::HTTP::Get.new(uri)
|
|
257
257
|
|
|
258
|
-
request['x-api-key']
|
|
258
|
+
request['x-api-key']='YOUR_API_KEY'
|
|
259
259
|
|
|
260
|
-
response
|
|
260
|
+
response=Net::HTTP.start(uri.hostname,uri.port,use_ssl:true)do|http|
|
|
261
261
|
|
|
262
|
-
|
|
262
|
+
http.request(request)
|
|
263
263
|
|
|
264
264
|
end
|
|
265
265
|
```
|
|
266
266
|
|
|
267
267
|
```php
|
|
268
|
-
$ch
|
|
268
|
+
$ch=curl_init('https://unavatar.io/github/kikobeats');
|
|
269
269
|
|
|
270
|
-
curl_setopt($ch,
|
|
270
|
+
curl_setopt($ch,CURLOPT_HTTPHEADER,[
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
'x-api-key: YOUR_API_KEY',
|
|
273
273
|
|
|
274
274
|
]);
|
|
275
275
|
|
|
276
|
-
curl_setopt($ch,
|
|
276
|
+
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
|
|
277
277
|
|
|
278
|
-
$response
|
|
278
|
+
$response=curl_exec($ch);
|
|
279
279
|
|
|
280
280
|
curl_close($ch);
|
|
281
281
|
```
|
|
@@ -291,13 +291,13 @@ Rate limit status can be verified using these response headers:
|
|
|
291
291
|
| `x-rate-limit-reset` | UTC epoch seconds when the current window resets |
|
|
292
292
|
|
|
293
293
|
```bash
|
|
294
|
-
$
|
|
294
|
+
$curl-Ihttps://unavatar.io/github/kikobeats
|
|
295
295
|
|
|
296
|
-
x-rate-limit-limit:
|
|
296
|
+
x-rate-limit-limit:25
|
|
297
297
|
|
|
298
|
-
x-rate-limit-remaining:
|
|
298
|
+
x-rate-limit-remaining:24
|
|
299
299
|
|
|
300
|
-
x-rate-limit-reset:
|
|
300
|
+
x-rate-limit-reset:1744243200
|
|
301
301
|
```
|
|
302
302
|
|
|
303
303
|
### Secret keys
|
|
@@ -307,85 +307,85 @@ Secret keys (`sk_`) are meant for server-side use only — never expose them pub
|
|
|
307
307
|
Pass them via the `x-api-key` header:
|
|
308
308
|
|
|
309
309
|
```html
|
|
310
|
-
|
|
310
|
+
<imgsrc="https://unavatar.io/github/kikobeats"/>
|
|
311
311
|
```
|
|
312
312
|
|
|
313
313
|
```bash
|
|
314
|
-
curl
|
|
314
|
+
curl"https://unavatar.io/github/kikobeats"-H"x-api-key: sk_YOUR_SECRET_KEY"
|
|
315
315
|
```
|
|
316
316
|
|
|
317
317
|
```javascript
|
|
318
|
-
|
|
318
|
+
awaitfetch('https://unavatar.io/github/kikobeats',{
|
|
319
319
|
|
|
320
|
-
|
|
320
|
+
headers:{
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
'x-api-key':'sk_YOUR_SECRET_KEY'
|
|
323
323
|
|
|
324
|
-
|
|
324
|
+
}
|
|
325
325
|
|
|
326
326
|
})
|
|
327
327
|
```
|
|
328
328
|
|
|
329
329
|
```python
|
|
330
|
-
|
|
330
|
+
importrequests
|
|
331
331
|
|
|
332
|
-
response
|
|
332
|
+
response=requests.get(
|
|
333
333
|
|
|
334
|
-
|
|
334
|
+
'https://unavatar.io/github/kikobeats',
|
|
335
335
|
|
|
336
|
-
|
|
336
|
+
headers={'x-api-key':'sk_YOUR_SECRET_KEY'}
|
|
337
337
|
|
|
338
338
|
)
|
|
339
339
|
```
|
|
340
340
|
|
|
341
341
|
```golang
|
|
342
|
-
|
|
342
|
+
packagemain
|
|
343
343
|
|
|
344
|
-
import
|
|
344
|
+
import"net/http"
|
|
345
345
|
|
|
346
|
-
|
|
346
|
+
funcmain(){
|
|
347
347
|
|
|
348
|
-
|
|
348
|
+
req,_:=http.NewRequest("GET","https://unavatar.io/github/kikobeats",nil)
|
|
349
349
|
|
|
350
|
-
|
|
350
|
+
req.Header.Set("x-api-key","sk_YOUR_SECRET_KEY")
|
|
351
351
|
|
|
352
|
-
|
|
352
|
+
resp,_:=http.DefaultClient.Do(req)
|
|
353
353
|
|
|
354
|
-
|
|
354
|
+
deferresp.Body.Close()
|
|
355
355
|
|
|
356
356
|
}
|
|
357
357
|
```
|
|
358
358
|
|
|
359
359
|
```ruby
|
|
360
|
-
require
|
|
360
|
+
require'net/http'
|
|
361
361
|
|
|
362
|
-
require
|
|
362
|
+
require'uri'
|
|
363
363
|
|
|
364
|
-
uri
|
|
364
|
+
uri=URI('https://unavatar.io/github/kikobeats')
|
|
365
365
|
|
|
366
|
-
request
|
|
366
|
+
request=Net::HTTP::Get.new(uri)
|
|
367
367
|
|
|
368
|
-
request['x-api-key']
|
|
368
|
+
request['x-api-key']='sk_YOUR_SECRET_KEY'
|
|
369
369
|
|
|
370
|
-
response
|
|
370
|
+
response=Net::HTTP.start(uri.hostname,uri.port,use_ssl:true)do|http|
|
|
371
371
|
|
|
372
|
-
|
|
372
|
+
http.request(request)
|
|
373
373
|
|
|
374
374
|
end
|
|
375
375
|
```
|
|
376
376
|
|
|
377
377
|
```php
|
|
378
|
-
$ch
|
|
378
|
+
$ch=curl_init('https://unavatar.io/github/kikobeats');
|
|
379
379
|
|
|
380
|
-
curl_setopt($ch,
|
|
380
|
+
curl_setopt($ch,CURLOPT_HTTPHEADER,[
|
|
381
381
|
|
|
382
|
-
|
|
382
|
+
'x-api-key: sk_YOUR_SECRET_KEY',
|
|
383
383
|
|
|
384
384
|
]);
|
|
385
385
|
|
|
386
|
-
curl_setopt($ch,
|
|
386
|
+
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
|
|
387
387
|
|
|
388
|
-
$response
|
|
388
|
+
$response=curl_exec($ch);
|
|
389
389
|
|
|
390
390
|
curl_close($ch);
|
|
391
391
|
```
|
|
@@ -397,7 +397,7 @@ Publishable keys (`pk_`) are safe to use in client-side code. They can **only**
|
|
|
397
397
|
Pass them as a `token` query parameter, which makes them easy to use directly in HTML markup:
|
|
398
398
|
|
|
399
399
|
```html
|
|
400
|
-
|
|
400
|
+
<imgsrc="https://unavatar.io/github/kikobeats?token=pk_YOUR_PUBLISHABLE_KEY"/>
|
|
401
401
|
```
|
|
402
402
|
|
|
403
403
|
### Domain restrictions
|
|
@@ -433,13 +433,13 @@ Every request has a cost in tokens (**\$0.010 per token**) based on the proxy ti
|
|
|
433
433
|
The proxy tier used is returned in the `x-proxy-tier` response header, and the total cost in the `x-unavatar-cost` header.
|
|
434
434
|
|
|
435
435
|
```bash
|
|
436
|
-
$
|
|
436
|
+
$curl-I-H"x-api-key: sk_YOUR_SECRET_KEY"https://unavatar.io/instagram/kikobeats
|
|
437
437
|
|
|
438
|
-
x-pricing-tier:
|
|
438
|
+
x-pricing-tier:pro
|
|
439
439
|
|
|
440
|
-
x-proxy-tier:
|
|
440
|
+
x-proxy-tier:origin
|
|
441
441
|
|
|
442
|
-
x-unavatar-cost:
|
|
442
|
+
x-unavatar-cost:1
|
|
443
443
|
```
|
|
444
444
|
|
|
445
445
|
To upgrade, visit [unavatar.io/checkout](https://unavatar.io/checkout). After completing the payment, you'll receive an API key.
|
|
@@ -469,11 +469,11 @@ To check the cache status in real requests, inspect these response headers:
|
|
|
469
469
|
| `cache-control` | Shows cache policy and effective TTL (for example `public, max-age=3600` for `ttl=1h`). |
|
|
470
470
|
|
|
471
471
|
```bash
|
|
472
|
-
$
|
|
472
|
+
$curl-I-H"x-api-key: sk_YOUR_SECRET_KEY""https://unavatar.io/github/kikobeats?ttl=1h"
|
|
473
473
|
|
|
474
|
-
cache-control:
|
|
474
|
+
cache-control:public,max-age=3600
|
|
475
475
|
|
|
476
|
-
x-cache-status:
|
|
476
|
+
x-cache-status:HIT
|
|
477
477
|
```
|
|
478
478
|
|
|
479
479
|
The same rule applies to anonymous requests: cache hits are free and do not consume the `25 requests/day` limit.
|
|
@@ -1170,21 +1170,21 @@ These headers help you understand pricing, limits, and request diagnostics.
|
|
|
1170
1170
|
| `retry-after` | Seconds until rate limit resets (only on 429 responses) |
|
|
1171
1171
|
|
|
1172
1172
|
```bash
|
|
1173
|
-
$
|
|
1173
|
+
$curl-I-H"x-api-key: sk_YOUR_SECRET_KEY"https://unavatar.io/github/kikobeats
|
|
1174
1174
|
|
|
1175
|
-
x-pricing-tier:
|
|
1175
|
+
x-pricing-tier:pro
|
|
1176
1176
|
|
|
1177
|
-
x-timestamp:
|
|
1177
|
+
x-timestamp:1744209600
|
|
1178
1178
|
|
|
1179
|
-
x-unavatar-cost:
|
|
1179
|
+
x-unavatar-cost:1
|
|
1180
1180
|
|
|
1181
|
-
x-proxy-tier:
|
|
1181
|
+
x-proxy-tier:origin
|
|
1182
1182
|
|
|
1183
|
-
x-rate-limit-limit:
|
|
1183
|
+
x-rate-limit-limit:50
|
|
1184
1184
|
|
|
1185
|
-
x-rate-limit-remaining:
|
|
1185
|
+
x-rate-limit-remaining:49
|
|
1186
1186
|
|
|
1187
|
-
x-rate-limit-reset:
|
|
1187
|
+
x-rate-limit-reset:1744243200
|
|
1188
1188
|
```
|
|
1189
1189
|
|
|
1190
1190
|
## Response Errors
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@unavatar/core",
|
|
3
3
|
"description": "Get unified user avatar from social networks, including Instagram, SoundCloud, Telegram, Twitter, YouTube & more.",
|
|
4
4
|
"homepage": "https://unavatar.io",
|
|
5
|
-
"version": "3.45.
|
|
5
|
+
"version": "3.45.13",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js",
|