Generate an API Key

To use AVM’s services, you’ll need an API key. Here’s how to generate one:

  1. Login to your AVM account
  2. Navigate to your AVM API Keys Dashboard
  3. Click on ”+ API Key” to generate new API Key
  4. Give your key a descriptive name (e.g., “Development Key”)
  5. Copy and securely store your API key - you won’t be able to see it again!

Never share your API key or commit it to version control. We recommend using environment variables to store your key securely.

Using Your API Key to run a sandbox

Once you have your API key, you can start using AVM’s services. Here’s how to authenticate your requests:

# Set your API key as an environment variable
export AVM_API_KEY='your_api_key_here'

# Example API request using curl
curl -X POST https://api.avm.codes/api/run/sync \
  -H "avm-x-api-key: $AVM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code": "print('Hello, world');"}'

Only Python code is supported at the moment by AVM Sandbox runs.

Example of python code to run in a sandbox:

import time;
print('Hello, world! Current time is: ', time.time());

The output of the above code will be the following JSON Response:

{
    "status": "COMPLETED",
    "output": "Hello, world! Current time is:  1739202370.1340144\n"
} 

Credit System

Each sandbox run consumes credits from your account. Here’s how the credit system works:

  • Every new account starts with 3600 free credits
  • Each second of sandbox execution costs 1 credit
  • Credits are consumed even in case of error occurrence
  • The maximum execution time for each run is 120 seconds
  • You can monitor your credit usage in the Credits

If you need more credits, you can purchase additional credits through your Credits page.