Create Avatar

API reference for creating avatar generation jobs.

Create Avatar Job

Generate a new AI avatar by creating a job.

Endpoint

POST /api/v1/projects/{project_id}/jobs/avatars

Authentication

Requires API key in Authorization header:

Authorization: Bearer sma_your_api_key

Request Body

{
  "style_id": "pixar-3d",
  "prompt_template_id": "avatar_spec_v2",
  "quality": "standard",
  "size": "square",
  "parameters": {
    "subject": "fox",
    "theme": "warrior",
    "gender": "female",
    "color": "orange"
  }
}

Required Fields

FieldTypeDescription
style_idstringArt style identifier (e.g., pixar-3d)
parametersobjectCustomization parameters
parameters.subjectstringSubject type (e.g., fox, cat, human)
parameters.themestringTheme/outfit (e.g., warrior, wizard, casual)
parameters.genderstringGender presentation (male, female, neutral)
parameters.colorstringPrimary color (e.g., orange, blue, purple)

Optional Fields

FieldTypeDefaultDescription
prompt_template_idstringavatar_spec_v2Template for prompt generation
qualitystringstandardQuality tier: economy, standard, high
sizestringsquareOutput size: square, landscape, portrait
parameters.seednumberrandomSeed for reproducibility

Response

Success (201 Created)

{
  "success": true,
  "job": {
    "id": "abc123-def456-ghi789",
    "job_type": "avatar",
    "project_id": "your-project-id",
    "style": {
      "id": "pixar-3d",
      "label": "Pixar 3D"
    },
    "quality": "standard",
    "size": "square",
    "status": "pending",
    "estimated_token_cost": 50,
    "created_at": "2024-01-15T10:30:00Z"
  },
  "message": "Avatar job created successfully. It will be processed shortly."
}

Error Responses

Insufficient Tokens (402)

{
  "statusCode": 402,
  "statusMessage": "Insufficient Tokens",
  "message": "Not enough tokens",
  "data": {
    "required_tokens": 50,
    "available_tokens": 25,
    "action_type": "avatar.generate.standard.square"
  }
}

Style Not Found (404)

{
  "statusCode": 404,
  "message": "Style 'invalid-style' not found or inactive"
}

Validation Error (400)

{
  "statusCode": 400,
  "message": "Parameter validation failed: subject is required"
}

Full Example

Request

curl -X POST 'https://api.smavatar.com/api/v1/projects/6229750c-2e90-4dc6-a041-6fedd61d1f66/jobs/avatars' \
  -H 'Authorization: Bearer sma_AqNYHpfSLGz51YEzJwqavCw6rTlxnlka' \
  -H 'Content-Type: application/json' \
  -d '{
    "style_id": "pixar-3d",
    "quality": "standard",
    "size": "square",
    "parameters": {
      "subject": "fox",
      "theme": "warrior",
      "gender": "female",
      "color": "orange"
    }
  }'

Check Status

curl 'https://api.smavatar.com/api/v1/projects/6229750c-2e90-4dc6-a041-6fedd61d1f66/jobs/avatars/abc123-def456-ghi789' \
  -H 'Authorization: Bearer sma_AqNYHpfSLGz51YEzJwqavCw6rTlxnlka'

Completed Response

{
  "success": true,
  "job": {
    "id": "abc123-def456-ghi789",
    "status": "completed",
    "actual_token_cost": 50,
    "assets": [
      {
        "id": "asset-uuid",
        "storage_path": "project-id/job-id/avatar.png",
        "format": "png",
        "width": 1024,
        "height": 1024
      }
    ]
  }
}

Image URL

Construct the full image URL from the storage_path:

https://hxqvyxnnppomqqwglxwo.supabase.co/storage/v1/object/public/avatars/{storage_path}

Rate Limits

  • 20 job creations per hour per API key
  • Returns 429 Too Many Requests if exceeded

Next Steps

Styles Guide

See all available art styles.

Parameters

Learn about subjects, themes, and colors.

Built with Nuxt UI • © 2025