Set up API key
Setting up CodeMash API keys for accessing services
To make calls to the CodeMash servers and access your resources, you will need - a project ID and a secret key.

Your CodeMash Project ID or Project ID is our primary identifier to differentiate your project from all other CodeMash projects. You will use this in all your SDK initialization codes and API calls. You should not treat the Project ID as private.

Do not share this key!
Treat your REST API Key as though it is a password - do not add it to your app code or public repositories (e.g., GitHub), and do not share it with anyone.

  1. 1.
    Login to the CodeMash dashboard.
  2. 2.
    Inside your CodeMash dashboard, select your project.
  3. 3.
    Inside your project settings, find settings called Project ID and Secret key.
    • For Project ID, copy it.
    • For Secret Key, press Regenerate and then copy generated token. The token will not be accessible after you close it; you must regenerate it.
In project settings, you regenerate the Secret Key of your project root account that was created automatically during the initialization process. Never use it in a production environment because this Secret Key has all the permissions, and malicious users can delete your resources and data. For this purpose, create a separate membership user of type "Service" and add only necessary permissions.

The following shows how to store tokens using different languages and frameworks.
.NET
Node
To store your tokens in private, use environment variables. This way, you won't expose your secret key to public places.
You can store your tokens in the appsettings.json (name can be different) file in your base project folder. CodeMash SDK expects the following format:
{
"CodeMash" : {
"ApiKey" : "{YOUR_SECRET_KEY}",
"ProjectId" : "{YOUR_PROJECT_ID}"
}
}
To store your tokens in private, use environment variables. This way, you won't expose your secret key to public places.

Import the CodeMash library and put the code snippet provided below in the initialization state of an app:
import { config } from 'codemash';
config.init({
secretKey: '<YOUR_SECRET_KEY>',
projectId: '<YOUR_PROJECT_ID>'
}, process.env.NODE_ENV)
Copy link
On this page
Project ID
Secret Key
How to find Project ID and Secret Key
Storing tokens