If you want to try out Avatar WEB API in action right now, please see the samples below.
Before you begin, please check our recommendations for improving the resulting model (in the order of significance):
More API usage examples are coming.
Root API URL: https://api.avatarsdk.com/
API endpoints produce JSON responses unless stated otherwise. Please see the Content-Type HTTP Header for a particular response format.
All POST requests accept multipart/form-data unless stated otherwise.
All mesh/pointcloud retrieval endpoints produce a zip archive with mesh/pointcloud in binary PLY format unless stated otherwise.
Before any of the API methods can be used, you should generate an application identifier (referenced later as client_id) for your app. This identifier is used to obtain the access token which is then used to sign actual API requests. You could use one of the official libraries listed on the OAuth site (recommended) or any other on your taste to add OAuth 2.0 support to your app.
To get your client_id and client_secret, please sign up for the AvatarSDK developer account.
Besides client_id and client_secret (depending on the application authorization grant type) you will need the following settings:
For more information on grant types, see section 4 of the OAuth 2.0 RFC document.
All requests that return lists are paginated: each particular request returns a list of requested objects (up to 100 objects per page) and links to the first, previous, next, and last pages in the Link HTTP header. If there are no other pages - the Link header will not be present.
The Link header may contain up to 4 entries separated by a comma ,. Each entry contains the URL itself and its relation name (rel) separated by a semicolon ;. See example below:
$ curl -v -X GET -H "Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu" -H "Accept: application/json" "https://api.avatarsdk.com/avatars/?page=3" > GET /avatars/?page=3 HTTP/1.1 > User-Agent: curl/7.35.0 > Host: api.avatarsdk.com > Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu > Accept: application/json > < HTTP/1.0 200 OK < Date: Mon, 03 Apr 2017 04:08:15 GMT < Link: <https://api.avatarsdk.com/avatars/>; rel="first", <https://api.avatarsdk.com/avatars/?page=2>; rel="prev", <https://api.avatarsdk.com/avatars/?page=4>; rel="next", <https://api.avatarsdk.com/avatars/?page=5>; rel="last" < Content-Type: application/json < Allow: GET, POST, HEAD, OPTIONS < [...]
For more information about the Link header, see the Web Linking RFC document.
Results of list-retrieving requests may be filtered by some fields of requested objects (e.g. creation time, status, etc.) by specifying filters as a query parameter. All filters are case-insensitive unless stated otherwise. Filters may be specified several times. In this case, they all will be joined via logical AND. See example below:
$ curl -v -H "Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu" -X GET "https://api.avatarsdk.com/avatars/?status=completed&description=fb" > GET /avatars/?status=completed&description=fb HTTP/1.1 > User-Agent: curl/7.35.0 > Host: api.avatarsdk.com > Accept: */* > Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu > < HTTP/1.0 200 OK < Date: Mon, 03 Apr 2017 04:08:15 GMT < Link: <https://api.avatarsdk.com/avatars/?description=fb&status=completed>; rel="first", <https://api.avatarsdk.com/avatars/?description=fb&page=1&status=completed>; rel="last" < Vary: Accept, Cookie < Content-Type: application/json < Allow: GET, POST, HEAD, OPTIONS < [...]
Please see the filters section in particular request documentation to find available filters.
API has two different access modes: developer and client access. The Client access mode is slightly more restricted in terms of access to some methods: e.g. it is restricted to list all avatars created with the same client_id and allowed to list only those created with the same PlayerUID, etc.
Please see the detailed description for each particular method to find more information about available access modes and their restrictions.
It is highly recommended to use Client access in applications released into production: malicious users won't be able to access or delete data of other users even if client_id and client_secret are compromised.
Client access mode requires signing each request with a PlayerUID identifier along with the OAuth access token. To do this you need to register PlayerUID once per unique application (e.g. on the first launch) and then sign each request with this PlayerUID via X-PlayerUID HTTP header. See example below:
$ curl -v -H "Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu" -H "X-PlayerUID: 9418fd52-baef-401c-a2b3-e6fe16d93596" -X GET "https://api.avatarsdk.com/avatars/" > GET /avatars/ HTTP/1.1 > User-Agent: curl/7.35.0 > Host: api.avatarsdk.com > Accept: */* > Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu > X-PlayerUID: 9418fd52-baef-401c-a2b3-e6fe16d93596 > < HTTP/1.0 200 OK < Date: Mon, 03 Apr 2017 04:08:15 GMT < Vary: Accept, Cookie < Link: <https://api.avatarsdk.com/avatars/>; rel="first", <https://api.avatarsdk.com/avatars/?page=1>; rel="last" < Content-Type: application/json < Allow: GET, POST, HEAD, OPTIONS < [...]
To keep our system stable and healthy, we introduced a throttling mechanism that limits how many HTTP requests any particular client is allowed to make. Current limits are set to the following values:
Please note: in the Client access mode there is no limit to the number of requests per SDK account. To avoid throttling, please make sure to follow these guidelines:
If an application exceeds limits it will receive HTTP 429 TOO MANY REQUESTS response code and Retry-After HTTP Response Header will be set to the number of seconds the application will need to wait to perform the next request. See example below:
$ curl -v -H "Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu" -X GET "https://api.avatarsdk.com/avatars/" > GET /avatars/ HTTP/1.1 > User-Agent: curl/7.35.0 > Host: api.avatarsdk.com > Accept: */* > Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu > < HTTP/1.0 429 TOO MANY REQUESTS < Date: Mon, 03 Apr 2017 04:08:15 GMT < Retry-After: 10 < Vary: Accept, Cookie < Content-Type: application/json < Allow: GET, POST, HEAD, OPTIONS < {"detail":"Request was throttled. Expected available in 10.0 seconds."}
Please note: this document describes only head_1.2 pipeline. There are more pipelines available. Please visit main document to find currently available pipelines.
Predicted head, haircut, and bust. All-in-one model with unique topology. Supports export parameters (multiple formats, unified or separate meshes, textures, etc).
Available starting Plus plan subscription.
Available subtypes:
Available LODs:
| base/legacy | base/mobile | |||
|---|---|---|---|---|
| LOD# | vertices | faces | vertices | faces |
| 0 | 28005 | 52577 | 30818 | 58258 |
| 1 | 16123 | 29999 | 21439 | 40000 |
| 2 | 8518 | 14999 | 16373 | 30000 |
| 3 | 5968 | 9999 | 11293 | 19999 |
| 4 | 4875 | 7999 | 6043 | 9999 |
| 5 | 4325 | 7000 | 4973 | 8000 |
| 6 | 3727 | 6000 | 4439 | 6999 |
| 7 | 4999 | 3199 | 2471 | 4000 |
Avatar computation parameters contain a set of flags and parameters to fine-tune the avatar computation process. These parameters have three levels of detail:
Please see the parameters retrieval request to retrieve a list of available and default parameters for each particular pipeline and pipeline subtype on your account.
Avatar SDK is capable of providing some meta-information about computed avatars from source photos like a haircut, skin, eye color, etc. Please find the list of available meta-information parameters below:
Compute facial landmarks. Landmark coordinates are represented as a flat JSON array with X, Y, and Z float components sequence for each landmark, or NaN (for each component) if no landmark is detected
Predict the person race from the submitted photo. Currently, three races are predicted (asian, black, and white) with certain confidence for each race in the range [0, 1] inclusive. The resulting information will include the most probable race with its confidence and a JSON Object with all races with their confidences. Please see the sample model info below:
{ "pipeline" : "head_2.0", "pipeline_subtype" : "bust/mobile", "race" : "white", "race_confidence" : 0.9999996423721313, "races" : { "asian" : 2.615514413124159e-13, "black" : 4.136433915391535e-07, "white" : 0.9999996423721313 } }
Please see the parameters retrieval request to retrieve a list of available model info flags for a particular pipeline type and pipeline subtype for your account.
$ curl -H "Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu" \ -H "X-PlayerUID: 9418fd52-baef-401c-a2b3-e6fe16d93596" \ -X POST \ "https://api.avatarsdk.com/avatars/" \ -F "pipeline=head_1.2" \ -F "pipeline_subtype=base/mobile" \ -F "name=info test" \ -F "parameters={\"model_info\": {\"plus\": [\"gender\"]}}" \ -F "photo=@photo.jpg" { "code": "d4a31ac7-4aab-4cdc-b70b-75e75fc6bd91", "created_on": "2019-10-01T08:16:03.831260Z", "description": "", "name": "test", "progress": 0, "status": "Uploading", "url": "https://api.avatarsdk.com/avatars/d4a31ac7-4aab-4cdc-b70b-75e75fc6bd91/" } $ curl -H "Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu" \ -H "X-PlayerUID: 9418fd52-baef-401c-a2b3-e6fe16d93596" \ -X GET \ "https://api.avatarsdk.com/avatars/d4a31ac7-4aab-4cdc-b70b-75e75fc6bd91/model_info/" { "gender": "female", "gender_confidence": 0.9999961853027344, "pipeline": "head_1.2", "pipeline_subtype": "base/mobile" }
Avatar SDK is aimed at producing recognizable photo-realistic avatars. However, there is demand for avatar modifications, leaving avatars recognizable, though. Please find available avatar modifications below.
Please note: all parameters for this category are key-value, and modify the original avatar respectively its description.
Add an eyelid shadow on top of the eye texture. Works only when parametric_eyes_texture is set. See the textures comparison below
Add a glare directly into the parametric eye texture. Works only when parametric_eyes_texture is set. Enabled by default. See the textures comparison below
Make the bottom of the model bust slightly curved. See the models comparison below
Attempt to make lighting more uniform. See the models comparison below
Recolor the eye iris directly on a model texture. Works only when parametric_eyes_texture is set. See textures comparison below for {"red": 0, "green": 255, "blue": 0} color
Recolor eye sclera directly on a model texture. Works only when parametric_eyes_texture is set. See textures comparison below for {"red": 0, "green": 255, "blue": 0} color
Recolor lips directly on a model texture. See models comparison below for {"red": 0, "green": 255, "blue": 0} color
Replace the eye texture from the submitted photo with the generated one with sclera and iris colors to match the photo version. Please note: always set for the indie/legacy_styled subtype of the animated_face pipeline. See the models comparison below
Attempt to remove a smile on the submitted photo before the actual avatar computation starts. Currently detects and removes mostly open smiles (e.g. smiles with mouth open). The status of a smile removal may be obtained later from the model information JSON Object by the remove_smile key (see avatar model information retrieval request). Please find the model comparison below.
Please note: modifies original photo, thus avatars computed on the same source photo with and without this flag may appear slightly different.
Attempt to remove a stubble on the submitted photo before the actual avatar computation starts. The status of a stubble removal may be obtained later from the model information JSON Object by the remove_stubble key (see avatar model information retrieval request). Please find the model comparison below.
Please note: modifies the original photo, thus avatars computed on the same source photo with and without this flag may appear slightly different.
Attempt to remove glasses on the submitted photo before the actual avatar computation starts. The status of glasses removal may be obtained later from the model information JSON Object by remove_glasses key (see avatar model information retrieval request). Please find the model comparison below
Optimize texture layout to occupy less space. See the textures comparison below
Make the model texture look slightly cartoonish. Please note: replaces original avatar texture. See the models comparison below
Recolor teeth directly on a model texture. See the models comparison below for {"red": 0, "green": 255, "blue": 0} color
| Parameter Name | Pipeline / Pipeline Subtype | ||
|---|---|---|---|
| head_1.2 | |||
| base/legacy | base/mobile | base/static | |
| add_eyelid_shadow | ✓ | ||
| add_glare | ✓ | ||
| curved_bottom | ✓ | ✓ | ✓ |
| enhance_lighting | ✓ | ✓ | ✓ |
| eye_iris_color | ✓ | ||
| eye_sclera_color | ✓ | ||
| lips_color | ✓ | ✓ | |
| parametric_eyes_texture | ✓ | ||
| remove_glasses | ✓ | ✓ | ✓ |
| remove_smile | ✓ | ✓ | ✓ |
| remove_stubble | ✓ | ✓ | ✓ |
| repack_texture | ✓ | ✓ | |
| slightly_cartoonish_texture | ✓ | ✓ | ✓ |
| teeth_color | ✓ | ✓ | |
Please see the parameters retrieval request to retrieve a list of available avatar modification parameters for a particular pipeline type and pipeline subtype for your account.
$ curl -H "Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu" \ -H "X-PlayerUID: 9418fd52-baef-401c-a2b3-e6fe16d93596" \ -X POST \ "https://api.avatarsdk.com/avatars/" \ -F "pipeline=head_1.2" \ -F "pipeline_subtype=base/mobile" \ -F "name=modifications test" \ -F "parameters={\"avatar_modifications\": {\"plus\": {\"lips_color\": {\"red\": 222, \"green\": 173, \"blue\": 190}}}}" \ -F "photo=@photo.jpg"
Similar to avatar modification parameters, see the description for that parameters category.
Please note: all parameters for this category are key-value, and modify the original avatar respectively its description.
Factor to modify avatar mesh to look more cartoon-like. The valid values range is [0, +∞). The usable values range is model-dependent and usually should be lower than 1
| Parameter Name | Pipeline / Pipeline Subtype |
|---|---|
| head_1.2 | |
| base/mobile | |
| cartoonish_v1.0 | ✓ |
Please see the parameters retrieval request to retrieve a list of available shape modifications parameters for a particular pipeline type and pipeline subtype for your account.
$ curl -H "Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu" \ -H "X-PlayerUID: 9418fd52-baef-401c-a2b3-e6fe16d93596" \ -X POST \ "https://api.avatarsdk.com/avatars/" \ -F "pipeline=head_1.2" \ -F "pipeline_subtype=base/mobile" \ -F "name=modifications test" \ -F "parameters={\"shape_modifications\": {\"indie\": {\"cartoonish_v0.3\": 0.5}}}" \ -F "photo=@photo.jpg"
Different blendshapes sets are available, depending on your use case: general animation, lip-sync, overall avatar shape modification, etc. Please consult each blendshapes set description for more information.
deprecated
The basic set of 45 facial blendshapes
Set of 51 facial blendshapes. This set is compatible with Apple ARKit: https://developer.apple.com/documentation/arkit/creating_face-based_ar_experiences
Please find our guides on how to use visemes for lipsync here: https://docs.avatarsdk.com/unity-plugin/3.0.1/additional_samples.html
| Parameter Name | Pipeline / Pipeline Subtype | |
|---|---|---|
| head_1.2 | ||
| base/legacy | base/mobile | |
| legacy_45 | ✓ | |
| mobile_51 | ✓ | |
| visemes_15 | ✓ | |
| visemes_17 | ✓ | |
Please see the parameters retrieval request to retrieve a list of available blendshapes for a particular pipeline type and pipeline subtype for your account.
You could request to compute additional textures along with the default one, which is always computed.
Mask in PNG format
Metalness map in JPG format
Roughness map in JPG format
Please see the parameters retrieval request to retrieve a list of available additional textures for a particular pipeline type and pipeline subtype for your account.
$ curl -H "Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu" \ -H "X-PlayerUID: 9418fd52-baef-401c-a2b3-e6fe16d93596" \ -X POST \ "https://api.avatarsdk.com/avatars/" \ -F "pipeline=head_1.2" \ -F "pipeline_subtype=base/mobile" \ -F "name=textures test" \ -F "parameters={\"additional_textures\": {\"base\": [\"slightly_cartoonish_texture\"]}}" \ -F "photo=@photo.jpg" { "code": "d4a31ac7-4aab-4cdc-b70b-75e75fc6bd91", "created_on": "2019-10-01T08:16:03.831260Z", "description": "", "name": "test", "progress": 0, "status": "Uploading", "url": "https://api.avatarsdk.com/avatars/d4a31ac7-4aab-4cdc-b70b-75e75fc6bd91/" } $ curl -H "Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu" \ -H "X-PlayerUID: 9418fd52-baef-401c-a2b3-e6fe16d93596" \ -X GET \ "https://api.avatarsdk.com/avatars/d4a31ac7-4aab-4cdc-b70b-75e75fc6bd91/textures/" [ { "file": "https://api.avatarsdk.com/avatars/d4a31ac7-4aab-4cdc-b70b-75e75fc6bd91/textures/model/file/", "identity": "model" }, { "file": "https://api.avatarsdk.com/avatars/d4a31ac7-4aab-4cdc-b70b-75e75fc6bd91/textures/slightly_cartoonish_texture/file/", "identity": "slightly_cartoonish_texture" } ] $ curl -H "Authorization: Bearer F88pQWs8hoPzbeCg4xTGifDxxs1eKu" \ -H "X-PlayerUID: 9418fd52-baef-401c-a2b3-e6fe16d93596" \ -X GET \ "https://api.avatarsdk.com/avatars/d4a31ac7-4aab-4cdc-b70b-75e75fc6bd91/textures/slightly_cartoonish_texture/file/" > slightly_cartoonish_texture.jpg
Avatar's export parameters contain a set of flags and parameters to specify what resulting avatar downloadable data should include: model format, set of textures, blendshapes, whether to embed all these assets into the one model or save as separate files, etc.
The general format for export parameters is the following:
{ "flag": value, "category": { "list": [values], "flag": value } }
Export parameters consist of top-level and category-level flags. Top-level flags are applied to the whole avatar and its categories (unless stated otherwise). Category-level flags are applied only to this particular category and overwrite top-level flags if they are of the same name and specified explicitly.
The category may contain enumerable values (like haircuts). These values must be specified within the list key of this particular category. Please look at the enumerable export parameters retrieval request to retrieve a list of available export parameters for each particular category for the pipeline and the pipeline's subtype for your account. Please note: to avoid ambiguity in specifying different computation and enumerable export parameters (i.e., haircuts and blendshapes), export parameters take precedence.
All flags and values are optional and replaced by default values if not specified explicitly. Default export parameters are the following:
{ "format": "gltf", "embed" : true, "pointclouds" : false, "additional_textures" : [], "embed_textures": false, "texture_size" : null, // i.e. maximum available "lod": 0, // i.e. maximum available "haircuts": { "list": [], "format": null, // i.e. top-level format "embed": null, // i.e. top-level value "pointclouds": null, // i.e. top-level value "color": null, "texture_size" : null, // i.e. top-level size "embed_textures": null // i.e. top-level value }, "outfits": { "list": [], "format": null, // i.e. top-level format "embed": null, // i.e. top-level value "pointclouds": null, // i.e. top-level value "additional_textures" : [], "texture_size" : null, // i.e. top-level size "embed_textures": null // i.e. top-level value } "blendshapes": { "list": [], "format": null, // i.e. top-level format "embed": null, // i.e. top-level value "pointclouds": null // i.e. top-level value } }
List of textures to export besides the default diffuse model texture. Available values are:
If texture supports recoloring, this flag specifies the base color for the recoloring process
If set to true, then the resulting model file will not contain mesh faces and UV mapping (i.e. it will contain only mesh vertices).
For meshes with regular topology (i.e. models where a number of vertices, edges, and how these vertices connected are the same, only vertices positions are different), it may be convenient to download full mesh only once and then download and replace only pointclouds (only vertices) for all future models to reduce the download data size
Resize texture to the specified size. The avatar texture size is 4096x2048 px. Most asset textures are 4096x4096 px for outfits and 2048x2048 px for haircuts, but size varies between assets. Please check the original texture size before setting a custom value as setting it greater than the original one will not result in improved texture quality.
Please note: if texture size is also set in avatar modification parameters - then texture is resized according to avatar modifications first, and then according to export parameters.
When export parameters are specified, algorithms generate export which consists of one or several export files depending on specified export parameters flags. In order to download all avatar's data, all files within one export have to be downloaded. Export file names are unique within one export and consistent from avatar to avatar export thus you may set priority to download export files in your application: e.g. avatar itself first, then its haircuts, etc.
Please see the avatar exports list request to find out how to list available avatar exports and their export files.
| [1] | (1, 2, 3, 4, 5, 6, 7, 8, 9) Color is represented as a JSON object with red, green, and blue keys and [0, 255] values inclusive for corresponding color channels. E.g. {"red": 222, "green": 173, "blue": 190} |
| [2] | Size is represented as a JSON object with width and height keys and positive integer values. E.g. {"width": 256, "height": 256} |
Player model DTO [*]:
{ // Absolute URL to this DTO "url": string, // Player unique identifier (PlayerUID) "code": string, // ISO 8601 datetime "created_on": string, // May be used to contain arbitrary information for your taste "comment": string }
| [*] | DTO is an acronym for Data Transfer Object |
[ { "url":"https://api.avatarsdk.com/players/9418fd52-baef-401c-a2b3-e6fe16d93596/", "code":"9418fd52-baef-401c-a2b3-e6fe16d93596", "created_on":"2017-04-03T04:08:15.589833Z", "comment":"" }, ... ]
Parameters DTO:
{ // Category of parameters. E.g. 'haircuts', 'blendshapes', etc. "category": { // Group of parameters. E.g. pricing plan or customer-specific group "group": [ // List of parameter names "name", ... ] }, ... }
Retrieve all available or default parameters for specified pipeline and default pipeline subtype. Use filters to retrieve parameters for the non-default pipeline subtype. The response is one key-value pair with pipeline_subtype as a key and parameters as a value.
Parameters may be just copy-pasted as-is (or partially) into the parameters field of create avatar request parameters. The only exception is the avatar_modifications parameters category: this category contains key-value parameters. See the avatar modification parameters section for details.
Please see the example response below (a little bit shortened for the sake of simplicity):
{ "base/mobile": { "blendshapes": { "base": [ "legacy_45", "visemes_17" ] } } }
Enumerable export parameters DTO:
{ // export parameters category "category": [ // list of enumerable parameters values ], ... }
/export_parameters/available/{pipeline}/
Retrieve all available enumerable export parameters for specified pipeline and a pipeline subtype. Use filters to retrieve parameters for the non-default pipeline subtype. The response is a JSON object of available enumerable values for each export parameters category.
Please see the example response below (a little bit shortened for the sake of simplicity):
{ "blendshapes": [ "mobile_51", "visemes_15" ] }
Avatar model DTO:
{ // Absolute URL to this DTO "url": string, // Avatar identifier "code": string, // Avatar models computing status. One of [Uploading, Queued, Computing, Completed, Failed, Timed Out] "status": string, // Current progress of avatar status. In rage [0:100] "progress": integer, // Avatar name "name": string, // Pipeline used to calculate avatar "pipeline": string, // Avatar description "description": string, // ISO 8601 datetime "created_on": string, // ISO 8601 last change datetime. May be `null` if it hasn't changed yet since the creation "ctime": string, // Absolute URL to retrieve Avatar source image thumbnail "thumbnail": string, // Absolute URL to retrieve JSON object with this avatar meta-information "model_info": string, // Absolute URL to retrieve a list of available avatar exports for this avatar model "exports": string }
[ { "url":"https://api.avatarsdk.com/avatars/b63f9737-8594-460a-99a4-74e60b042bd4/", "code":"b63f9737-8594-460a-99a4-74e60b042bd4", "status":"Completed", "progress":100, "name":"Leo", "pipeline": "animated_face", "description":"", "created_on":"2017-04-03T04:08:15.589833Z", "ctime":null, "thumbnail":"https://api.avatarsdk.com/avatars/b63f9737-8594-460a-99a4-74e60b042bd4/thumbnail/", "exports":"https://api.avatarsdk.com/avatars/b63f9737-8594-460a-99a4-74e60b042bd4/exports/" }, ... ]
Create a new avatar calculation task. Available in developer and client access modes. After POSTing a request, the avatar photo for the calculation is uploaded to the calculation backend (state Uploading), then Queued until a free calculation backend is found, then Computing, and finally Completed.
In some cases, the calculation task may be Failed due to a bad (blurry/dark/etc.) photo being submitted or for some other reasons. In rare cases task may be Timed out - calculation took too long time.
It is your responsibility to poll the avatar calculation task for progress (status and progress fields of avatar DTO). Access to the URL fields of the incomplete avatar will not succeed.
Accepts multipart/form-data requests with the following fields:
name - new avatar name
description - new avatar description
photo - new avatar source photo. Either a photo or a selfie must be provided. Error is returned if none or both are provided
selfie - selfie code. Please see the selfies section to learn more about selfies. Either a selfie or a photo must be provided. Error is returned if none or both are provided. Error is returned if the selfie file has not uploaded yet by the end-user
pipeline - an optional field to specify which pipeline to use for new avatar generation. Please see the the available pipelines for the list of possible field values. The assumed value is animated_face if the form field is not provided
pipeline_subtype - modification of pipeline. Please see available pipelines for the list of possible field values
parameters - specific parameters to compute for the submitted avatar. See parameters DTO for this field format. If no value is submitted - it is replaced with default parameters for the specified pipeline and (optionally) pipeline subtype. See the parameters retrieval request to find out default/available parameters for pipeline type/subtype pairs. If no parameters are required to compute the avatar - submit an empty JSON object: {}
export_parameters - parameters to specify what resulting avatar downloadable data should include: like model format, set of textures, blendshapes, whether to embed all these assets into the one model or save as separate files, etc. Please see the export parameters section to find out more.
Please note: if this section is empty - no avatar exports will be created.
export_comment - avatar export comment. An arbitrary string, note to self, etc.
Accepts multipart/form-data requests with the following fields:
Retrieve the number of avatars created (created field), the number of free avatars left (i.e. included in your billing plan, prepaid field), and the number of avatars to be paid (to_pay field) in the current billing period.
The time frame to count avatars may be specified with since and until filters. In this case, only the number of created avatars is returned.
Please see the example response below:
{ "created": 8192, "prepaid": 0, "to_pay": 2192 }
Retrieve JSON object with avatar model meta-information requested on avatar creation. Please see the model info parameters section for available parameters.
Please see the example response below:
{ "age": "not_child", "age_confidence": 1, "gender": "male", "gender_confidence": 0.9999961853027344, "hair_color": { "blue": 114, "green": 145, "red": 199 }, "pipeline": "head_1.2", "pipeline_subtype": "base/mobile", "skin_color": { "blue": 151, "green": 181, "red": 235 } }
For some applications, it may be the case, that the camera or selfie photo is not available within the same device (e.g. an application on a desktop computer without an attached web camera). At the same time, almost everyone has cameras or selfies on his/her mobile phone, but it may be inconvenient to transfer these photos to the device with the application.
The solution is to create a selfie upload page, visit it within the mobile device, and upload a new or existing selfie photo. For end-user convenience, the QR code with the upload page URL is also available. After uploading the photo, the application could download the photo and continue its workflow of avatar creation. It is also possible to avoid the photo download step by passing the selfie code into the avatar creation request directly.
Please note: only one photo can be uploaded per selfie upload page. To upload a new photo, a new selfie upload page must be created.
Selfie model DTO:
{ // Selfie code "code": string, // ISO 8601 datetime after which, the selfie will be unavailable (24 hours currently) "expires": string, // Absolute URL to selfie file "file_url": string, // Absolute URL to QR code file with selfie upload page URL "upload_page_qr": string, // Absolute URL to selfie upload page "upload_page_url": string, // Flag indicates whether the upload page visited "upload_page_visited": boolean, // Absolute URL to this DTO "url": string }
Avatar export DTO:
{ // Avatar identifier "avatar_code": string, // Avatar export identifier "code": string, // Avatar export comment, may be `null` if not present "comment": string, // ISO 8601 datetime "created_on": string, // List of Avatar Export files "files": [ // Avatar Export file { // Category of Avatar Export file "category": string, // Absolute URL to retrieve the Avatar Export file zip archive "file": string, // Avatar Export file identifier "identity": string, // List of Static files for Avatar Export file "static_files": [ // absolute URL to retrieve Static file string ] }, ... ], // Status of Avatar Export. One of [Queued, Computing, Completed, Failed] "status": string, // Absolute URL to this DTO "url": string }
[ { "avatar_code": "e56d6044-fdbf-4cbf-86df-793bf21494f4", "code": "c0fc0ece-e291-4bbe-bdf2-ece270e0e065", "created_on": "2020-11-16T12:57:03.641470Z", "files": [ { "category": null, "file": "https://api.avatarsdk.com/avatars/e56d6044-fdbf-4cbf-86df-793bf21494f4/exports/c0fc0ece-e291-4bbe-bdf2-ece270e0e065/files/avatar/file/", "identity": "avatar", "static_files": [] }, { "category": "blendshapes", "file": "https://api.avatarsdk.com/avatars/e56d6044-fdbf-4cbf-86df-793bf21494f4/exports/c0fc0ece-e291-4bbe-bdf2-ece270e0e065/files/mobile_51/file/", "identity": "mobile_51", "static_files": [] } ], "status": "Completed", "url": "https://api.avatarsdk.com/avatars/e56d6044-fdbf-4cbf-86df-793bf21494f4/exports/c0fc0ece-e291-4bbe-bdf2-ece270e0e065/" } ]
Retrieve a particular Avatar export file. Avatar is identified by the code URL part, Avatar export is identified by the export_code URL part, and the export file is identified by the export_file URL part. Please see the avatar export DTO to see where to find each URL part.
Please note: all export files and their static files must be downloaded to retrieve full Avatar export.
Create a subsequent avatar export on already Completed avatar. Please see the avatar export DTO section for the response format. May be useful to create an avatar export with a different list of assets.
After POSTing a request, the avatar export task is created and being transitioned through the following states: Queued, Computing, Completed, Failed. It is your responsibility to poll the avatar export task for the progress.
Accepts multipart/form-data requests with the following fields: