Skip to content

Can I specify secrets when creating a Code Sandbox via POST API? #5732

Answered by andrasbacsai
petrbrzek asked this question in Q&A
Discussion options

You must be logged in to vote

Hey,

You can use our Define API to dynamically define a sandbox through our API: https://codesandbox.io/docs/api/#define-api

Here is a payload for defining a simple container sandbox:

{
    "files": {
        "package.json": {
            "content": {
                "scripts": {
                    "start": "./node_modules/node/node_modules/.bin/node ./node_modules/nodemon/bin/nodemon.js ./src/index.js"
                },
                "dependencies": {
                    "node": "14.2.0"
                },
                "devDependencies": {
                    "nodemon": "^1.18.4"
                }
            }
        },
        "src/index.js": {
            "content": "console.l…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@petrbrzek
Comment options

Answer selected by petrbrzek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants