CodeMash
  • 🚀Backend as a service
  • 🦄Roadmap
  • 🍕Release Notes
  • Installation
    • Managed Service
    • 🏗️AWS-CDK
    • 🏗️Azure
    • 🏗️Docker
    • 🏗️GC
    • 🏗️Terraform
  • dashboard
    • CodeMash Cloud
    • Project
    • Membership
      • Users
      • Roles
      • Policies
      • Triggers
      • Integrations
        • Apple
        • Azure
        • Facebook
        • Google
        • Twitter
      • Settings
    • Database
      • Collections
        • Schema
          • From Template
          • Structure
        • Tabs
        • Triggers
        • Indexes
        • Shared Forms
      • Taxonomies
        • Terms
        • Schema
        • Settings
      • Aggregation
      • Imports
      • Exports
      • Backups
    • Files
      • Integrations
        • CodeMash
        • S3 Bucket
    • Notifications
      • Push
        • Push Templates
        • Push Templates API
        • Push Notifications
        • Push Notifications API
        • Devices
        • Devices API
        • Integrations
          • Firebase
          • One Signal
          • Expo
      • Email
        • Email Templates
        • Emails
        • Integrations
          • AWS SES
          • Twilio Sendgrid
          • Mailgun
      • 🏗️Server events
      • 🏗️Sms
    • Payments
      • Integrations
        • Apple Pay
        • Google Pay
        • Stripe
        • Kevin.
        • Paysera
        • Decta
    • Scheduler
    • Logs & Monitoring
    • Code
      • Functions
        • Function Inputs
        • Function Templates
          • Node.js
          • Python
          • Ruby
          • Java
          • Go
          • .NET Core
      • CodeMash Functions
        • Google Functions
          • Google Calendar
          • Google Gmail
        • Microsoft Functions
          • Microsoft 365 Users
          • Microsoft 365 Calendar
        • Collection Find
        • Collection Update
        • Users Find
        • Image Resize
        • Html To Pdf
        • Word Document
        • Barcode
        • QR Code
        • Send Email
        • Send Notification
        • Email Reminder
        • Notification Reminder
      • Integrations
        • AWS Lambda
        • Google Cloud Functions
        • Azure Functions
  • Other Topics
    • Apple
      • Developer Portal
      • Bundle Identifier
      • Team ID
      • Service ID
      • Key ID
    • Triggers
    • Tokens Binding
      • Project Tokens
      • Initiator Tokens
      • Receiver Tokens
      • Request Tokens
      • Operation based tokens
      • Template Functions
    • Search parameters
      • Paging
      • Filter
      • Sort
      • Projection
    • data-models
    • Errors
  • SDK
    • Node.js
    • TypeScript
    • .NET
    • 🏗️Go Lang
    • 🏗️Flutter
    • 🏗️Swift
    • 🏗️Kotlin
  • CLI
    • 🏗️CodeMash CLI
  • API
    • Get Started
    • Prerequisites
    • How to test?
    • Cors
    • Project
    • Membership
      • Authentication
      • Users
    • Database
      • Collections
        • Aggregate
        • Change Responsibility
        • Count
        • Delete
        • Delete Many
        • Distinct
        • Find
        • Find One
        • Insert
        • Insert Many
        • References
        • Replace
        • Update
        • Update Many
      • Taxonomies
        • Find
    • Files
    • Code
    • Notifications
      • Push
      • Emails
      • Server Events
      • 🏗️Sms
    • Payments
    • Scheduler
    • Logs & Monitoring
Powered by GitBook
On this page
  • Project ID
  • Secret Key
  • How to find Project ID and Secret Key
  • Storing tokens

Was this helpful?

Edit on GitHub
  1. API

Prerequisites

Setting up CodeMash API keys for accessing services

PreviousGet StartedNextHow to test?

Last updated 2 years ago

Was this helpful?

To make calls to the CodeMash servers and access your resources, you will need - a project ID and a secret key.

Project ID

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.

Secret Key

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.

How to find Project ID and Secret Key

  1. Login to the .

  2. Inside your CodeMash dashboard, select your project.

  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.

Storing tokens

The following shows how to store tokens using different languages and frameworks.

Environment variables (Recommended)

To store your tokens in private, use environment variables. This way, you won't expose your secret key to public places.

App Settings (Not recommended)

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}"
  }
}

Environment variables (Recommended)

To store your tokens in private, use environment variables. This way, you won't expose your secret key to public places.

Initialize CodeMash

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)
CodeMash dashboard