Skip to content

Authentication

V2Fun API uses Bearer Token authentication. Every request must include a valid API key issued to your account.

Obtaining an API Key

API keys are managed through the V2Fun developer console. Contact us or visit your account dashboard to create and manage your keys.

Keep your key safe

Treat your API key like a password. Never expose it in client-side code, public repositories, or logs.

Making Authenticated Requests

Include your API key in the Authorization header of every request:

http
Authorization: Bearer YOUR_API_KEY

Code examples

bash
curl -X POST "https://api.v2fun.ai/api/v1/images/generations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "A beautiful sunset"}'
javascript
const response = await fetch("https://api.v2fun.ai/api/v1/images/generations", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ prompt: "A beautiful sunset" })
});
python
import requests

response = requests.post(
    "https://api.v2fun.ai/api/v1/images/generations",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
    },
    json={"prompt": "A beautiful sunset"}
)

API Key Scopes

Each API key is granted one or more scopes that control which endpoints it can access. Calling an endpoint without the required scope returns 403 Forbidden.

ScopeDescription
image:promptImage captioning and prompt enhancement
image:imgenText-to-image generation
image:imgeditImage editing
model:meshText / image to 3D mesh generation
model:texture3D model texture generation
model:remesh3D model remeshing
model:convert3D model format conversion
model:render3D model rendering
motion:animateAnimation retargeting
motion:queryMotion retrieval
video:captureVideo motion capture (pose detection, motion detection)
asset:readRead generated asset files

INFO

Contact us if you need access to additional scopes not currently assigned to your key.

Security Best Practices

  • Use environment variables — store your key in .env files or secret managers, never hard-code it.
  • Restrict scope — request only the scopes your application actually needs.
  • Rotate regularly — regenerate your key periodically or immediately if you suspect it has been compromised.
  • Never log keys — ensure your logging pipeline strips Authorization headers before writing to storage.

Authentication Errors

HTTP StatusCodeMeaning
401 UnauthorizedUNAUTHORIZEDMissing or invalid Authorization header / expired key
403 ForbiddenFORBIDDENKey is valid but does not have the required scope for this endpoint

When you receive a 401, verify that:

  1. The Authorization header is present and formatted as Bearer YOUR_API_KEY.
  2. The key has not been revoked or expired.
  3. You are sending the request to the correct API host.