Skip to content
Socaity Docs

API Keys

Create and manage API keys for authenticating with the Socaity platform.

Create an API Key

  1. Log in at socaity.ai
  2. Navigate to Account → API Keys
  3. Click Create key
  4. Give the key a descriptive name (e.g. production-app)
  5. Copy the key — it will not be shown again

Using Your Key

The recommended approach is to set SOCAITY_API_KEY as an environment variable. All SDK constructors will pick it up automatically.

terminal
# .env (never commit this file)
SOCAITY_API_KEY=sk_your-key-here

# Or export inline for shell sessions
export SOCAITY_API_KEY=sk_your-key-here
python
import os
from socaity import face2face

# All models read SOCAITY_API_KEY — including Replicate-backed ones
f2f = face2face(api_key=os.getenv("SOCAITY_API_KEY"))
result = f2f.swap_img_to_img(
    source_img="me.jpg",
    target_img="target.jpg",
).get_result()

Security Best Practices

Environment Variables

Always load keys from environment variables, never hard-code them in source.

Keep Out of Git

Add .env to .gitignore. Use a secrets manager for CI/CD pipelines.

One Key per Service

Create separate keys per service or environment so you can rotate them independently.

Rotate Regularly

Rotate keys every 90 days or immediately after any suspected exposure.

Rotate a Key

To rotate a key: create a new key, update your environment variables, then delete the old key from the dashboard.