freestyle-sandboxes 0.0.30 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/openapi.json CHANGED
@@ -1 +1,3016 @@
1
- {"openapi":"3.1.0","info":{"title":"Freestyle Sandboxes","description":"\nFreestyle Sandboxes lets you deploy your users or AIs code. **Get your API Key at [admin.freestyle.sh](https://admin.freestyle.sh)**\n\nThey are broken up into core 5 categories: [Web](#tag/web), [Execute](#tag/execute), [Cloudstate](#tag/cloudstate), [Git](#tag/git), and [Domains](#tag/domains).\n\n[Web](#tag/web): Send us the code for the website, we'll provision the certificates and get it hosted\n\n[Execute](#tag/execute): Send us a function, we'll run it and send you the output\n\n[Cloudstate](#tag/cloudstate): Our Opensource JavaScript Runtime used for cloud functions with persistent state\n\n[Domains](#tag/domains): Manage your domains, including verification and listing\n\n[Git](#tag/git): Manage your git repositories\n","contact":{"name":"Ben","email":"ben@freestyle.sh"},"license":{"name":""},"version":"0.1.0"},"servers":[{"url":"https://api.freestyle.sh","description":"Production"}],"paths":{"/cloudstate/v1/deploy":{"post":{"tags":["Cloudstate"],"summary":"Deploy Cloudstate Project","description":"Deploy a cloudstate project","operationId":"handle_deploy_cloudstate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeployRequest"}}},"required":true},"responses":{"200":{"description":"successfully deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeploySuccessResponse"}}}},"500":{"description":"failed to deploy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleCloudstateDeployErrorResponse"}}}}}}},"/cloudstate/v1/projects/{id}/backup":{"get":{"tags":["Cloudstate"],"summary":"Get Backup of Cloudstate Project","description":"Get a backup of a cloudstate project","operationId":"handle_backup_cloudstate","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"successfully backed up","content":{"application/octet-stream":{"schema":{"type":"array","items":{"type":"integer","format":"int32","minimum":0}}}}},"500":{"description":"failed to backup"}}}},"/dns/v1/records":{"get":{"tags":["DNS"],"summary":"List DNS Records","operationId":"handle_list_records","parameters":[{"name":"domain","in":"query","required":true,"schema":{"type":"string"},"example":"example.com"}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListRecordsResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["DNS"],"summary":"Create DNS Record","operationId":"handle_create_record","parameters":[{"name":"domain","in":"query","required":true,"schema":{"type":"string"}},{"name":"record","in":"query","required":true,"schema":{"$ref":"#/components/schemas/DnsRecord"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/DnsRecord"}}}}}},"400":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["DNS"],"summary":"Delete DNS Record","operationId":"handle_delete_record","parameters":[{"name":"domain","in":"query","required":true,"schema":{"type":"string"},"example":"example.com"},{"name":"record","in":"query","required":true,"schema":{"$ref":"#/components/schemas/DnsRecord"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"400":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/domains/v1/certs/{domain}/wildcard":{"post":{"tags":["Certs","Domains"],"summary":"Provision a wildcard certificate","description":"Provisions a wildcard certificate for a verified domain\n\n\nThis speeds up deploys on all subdomains of the domain. In order to use it, you must add the following record to your DNS config:\n\n`_acme-challenge.yourdomain.com` NS `dns.freestyle.sh`","operationId":"handle_verify_wildcard","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Domain verified","content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to preverify domain","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.provisionWildcard('example.com').then((cert) => {\n console.log(cert);\n});"}]}},"/domains/v1/domains":{"get":{"tags":["Domains"],"summary":"List domains for an account","description":"This lists the domains that an account has verified ownership of. This includes the *.style.dev domains the account has claimed.","operationId":"handle_list_domains","responses":{"200":{"description":"List of domains","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","required":["domain","createdAt"],"properties":{"domain":{"type":"string","example":"example.yourdomain.com"},"createdAt":{"type":"integer","format":"int64"}}}}}}},"400":{"description":"Failed to get domains","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listDomains().then((response) => {\n console.log(response);\n});"}]}},"/domains/v1/mappings/{domain}":{"post":{"tags":["Domains"],"summary":"Insert Domain Mapping","description":"This will unmap any other deployment to this domain","operationId":"handle_insert_domain_mapping","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDomainMappingRequest"}}},"required":true},"responses":{"200":{"description":"Successfully mapped domain to deployment"},"401":{"description":"You do not have permission to do this","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"422":{"description":"Failed to provision certificate","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Failed to insert ownership","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"502":{"description":"Failed to check permissions","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["Domains"],"summary":"Remove Domain Mapping","operationId":"handle_delete_domain_mapping","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully removed domain mapping to deployment"},"401":{"description":"You do not have permission to do this","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Failed to insert ownership","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"502":{"description":"Failed to check permissions","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/domains/v1/verifications":{"get":{"tags":["Domains"],"summary":"List domain verification requests for an account","description":"Lists domain verification requests for the current account.","operationId":"handle_list_domain_verification_requests","responses":{"200":{"description":"List of verification codes","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","required":["verificationCode","domain","createdAt"],"properties":{"verificationCode":{"type":"string"},"domain":{"type":"string"},"createdAt":{"type":"integer","format":"int64"}}}}}}},"400":{"description":"Failed to get verification codes","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listDomainVerificationRequests().then((response) => {\n console.log(response);\n});"}]},"put":{"tags":["Domains"],"summary":"Verify a domain verification request","description":"This checks a pre-existing verification request for a domain. To create a verification request, call the [create domain verification](/#tag/domains/POST/domains/v1/verifications) endpoint. This endpoint will check if the domain has a TXT record with the verification code. If it does, the domain will be verified.","operationId":"handle_verify_domain","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleVerifyDomainRequest"}}},"required":true},"responses":{"200":{"description":"Domain verified","content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to verify domain","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Domain verification request not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .verifyDomain('example.com')\n .then((result) => {\n console.log('Successfully Verified Domain!');\n })\n .catch((error) => {\n console.error('Failed to verify domain: ', error);\n });"}]},"post":{"tags":["Domains"],"summary":"Create a domain verification request","description":"This creates a Freestyle Domain Verification Request. It returns a `verificationCode` for your domain. You need to place this code in a TXT record at `_freestyle_custom_hostname.thedomain.com`, then call the [verify domain](/#tag/domains/PUT/domains/v1/verifications) endpoint with the domain to verify it.","operationId":"handle_create_domain_verification","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDomainVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Verification code created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainVerificationRequest"}}}},"400":{"description":"Failed to create verification code","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi.createDomainVerificationRequest('example.com').then((result) => {\n const verificationCode = result.verificationCode;\n // put this at a TXT record at _freestyle_custom_hostname.example.com\n});"}]},"delete":{"tags":["Domains"],"summary":"Delete a domain verification request","description":"This deletes a Freestyle Domain Verification Request. This does not remove the domain from the account if it has already been verified, however the verification code will no longer be valid.","operationId":"handle_delete_domain_verification","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeleteDomainVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Verification code created","content":{"application/json":{"schema":{"type":"object","required":["verificationCode","domain"],"properties":{"verificationCode":{"type":"string"},"domain":{"type":"string","example":"example.com"}}}}}},"400":{"description":"Failed to create verification code","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/execute/v1/deployments":{"get":{"tags":["Execute"],"summary":"List execute runs","description":"List execute runs.","operationId":"handle_list_execute_runs","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"minimum":0}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["entries","total","offset"],"properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/ExecuteLogEntry"}},"total":{"type":"integer","format":"int64","minimum":0},"offset":{"type":"integer","format":"int64","minimum":0}}}}}},"500":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listExecuteRuns().then((runs) => {\n console.log(runs);\n});"}]}},"/execute/v1/deployments/{deployment}":{"get":{"tags":["Execute"],"summary":"Get information on execute run","description":"Get information on execute run","operationId":"handle_get_execute_run","parameters":[{"name":"deployment","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["metadata","code"],"properties":{"metadata":{"$ref":"#/components/schemas/ExecuteLogEntry"},"code":{"$ref":"#/components/schemas/ExecuteRunInfo"}}}}}},"401":{"description":"Unauthorized access","content":{"application/json":{"schema":{"type":"object","description":"Unauthorized access","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","description":"Not found","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","description":"Internal server error","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.getExecuteRun('123e4567-e89b-12d3-a456-426614174000').then((runs) => {\n console.log(runs);\n});"}]}},"/execute/v1/script":{"post":{"tags":["Execute"],"summary":"Execute Code","description":"Send a TypeScript or JavaScript module, get the result","operationId":"handle_execute_script","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleExecuteScriptParams"}}},"required":true},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["result","logs"],"properties":{"result":{"description":"The return value of the default export of the script"},"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.executeScript(\n `export default () => {\n let set1 = [1, 2, 3, 4, 5];\n let set2 = [4, 5, 6, 7, 8];\n\n // find the sum of every value of each set multiplied by every value of the other set\n\n let sum = 0;\n for (let i = 0; i < set1.length; i++) {\n for (let j = 0; j < set2.length; j++) {\n sum += set1[i] * set2[j];\n }\n }\n\n return sum;\n};`\n);"},{"label":"Vercel AI SDK","lang":"javascript","source":"import { executeTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst codeExecutor = executeTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n codeExecutor,\n },\n maxSteps: 2,\n prompt:\n 'What is the sum of every number between 1 and 12 multiplied by itself?',\n});"},{"label":"Mastra AI SDK","lang":"javascript","source":"import { executeTool } from 'freestyle-sandboxes/mastra';\n\nconst mastra = new Mastra();\n\nconst modelConfig: ModelConfig = {\n provider: 'OPEN_AI',\n name: 'gpt-4',\n};\n\nconst llm = mastra.LLM(modelConfig);\n\nconst response = await llm.generate(\n 'Calculate the sum of every number between 13 and 19 divided by the sum of every number between 8 and 13',\n {\n tools: {\n executor: executeTool({\n apiKey: process.env.FREESTYLE_API_KEY!,\n }),\n },\n }\n);\n\nconsole.log('Response Steps:', response.steps);\nconsole.log('Response:', response.text);"},{"label":"LangGraph AI SDK","lang":"javascript","source":"import { createReactAgent } from '@langchain/langgraph/prebuilt';\nimport { ChatOpenAI } from '@langchain/openai';\nimport { executeTool } from 'freestyle-sandboxes/langgraph';\n\nconst model = new ChatOpenAI({ model: 'gpt-4o' });\n\nconst agent = createReactAgent({\n llm: model,\n tools: [\n executeTool({\n apiKey: process.env.FREESTYLE_API_KEY,\n nodeModules: {\n resend: '4.0.1',\n },\n envVars: {\n RESEND_API_KEY: process.env.RESEND_API_KEY,\n },\n }),\n ],\n});\n\nconst result = await agent.invoke(\n {\n messages: [\n { role: 'user', content: 'What is the factorial of 13 divided by 55^2' },\n ],\n },\n { configurable: { thread_id: 42 } }\n);\nconsole.log(result.messages.at(-1)?.content);"},{"label":"Python SDK","lang":"python","source":"import freestyle\nimport os\n\nclient = freestyle.Freestyle(\n os.environ.get('FREESTYLE_API_KEY')\n)\n\ncodeExecutionResult = client.executeScript(\n \"\"\"\nimport Stripe from 'stripe';\nexport default async () => {\n\nconst stripe = new Stripe(process.env.STRIPE_API_KEY);\n\nconst paymentIntent = await stripe.paymentIntents.create({\n amount: 1099,\n currency: 'usd',\n payment_method_types: ['card'],\n});\n\nreturn paymentIntent;\n};\n \"\"\",\n freestyle.FreestyleExecuteScriptParamsConfiguration(\n env_vars={\"STRIPE_API_KEY\": os.environ.get(\"STRIPE_API_KEY\")},\n node_modules={\"stripe\": \"17.7.0\"},\n ),\n)\n\nprint('The payment intent created is:', codeExecutionResult)"},{"label":"Gemini Python SDK","lang":"python","source":"import google.genai as genai\nfrom google.genai import types\n\nimport os\nimport freestyle.gemini\n\nclient = genai.Client(api_key=os.environ.get(\"GENERATIVEAI_API_KEY\"))\n\n\n# model = genai.client.com(\"gemini-2.0-flash\")\ndefinition, runner = freestyle.gemini.executeTool(\n os.environ.get(\"FREESTYLE_API_KEY\"),\n)\nchat = client.chats.create(\n model=\"gemini-2.0-flash\",\n config=types.GenerateContentConfigDict(\n tools=[definition],\n ),\n history=[],\n)\n\nresponse = chat.send_message(\n \"What is the sum of every number from 50 to 65 divided by 17\"\n).candidates[0]\ntool_result = runner(response.content)\n\nprint(\"Answer: \", tool_result)"},{"label":"OpenAI Python SDK","lang":"python","source":"import os\nimport openai\nimport freestyle.openai\n\nclient = openai.OpenAI(\n api_key=os.environ.get('OPENAI_API_KEY'),\n)\n\n\n(definition, runner) = freestyle.openai.executeTool(\n os.environ.get('FREESTYLE_API_KEY'),\n)\n\nquery = 'What is the sum of every number from 50 to 65 divided by 17'\nmessages = [{'role': 'user', 'content': query}]\nprint('Question: ', query)\n\nres = client.chat.completions.create(\n model='gpt-4-turbo', messages=messages, tools=[definition]\n)\n\n\nresult = runner(res.choices[0].message)\n\nmessages.append(res.choices[0].message)\nif len(result) > 0:\n messages.extend(result)\n\nres = client.chat.completions.create(\n model='gpt-4-turbo',\n messages=messages,\n tools=[definition],\n)\n\nprint('Answer: ', res.choices[0].message.content)"},{"label":"Pipecat Python SDK","lang":"python","source":"# First, configure your LLM service with executeToolDefinition from freestyle.openai or freestyle.gemini depending on the service you are using\n# Assuming you've done that already, and your service is named llm:\n\nfrom freestyle.pipecat import executeTool, EXECUTE_TOOL_NAME\nimport os\n\nllm.register_function(\n EXECUTE_TOOL_NAME,\n executeTool(os.environ.get('FREESTYLE_API_KEY'))\n)"}]}},"/git/v1/identity":{"post":{"tags":["Git"],"summary":"Create a Git identity","description":"Create a Git identity. This identity will be used to authenticate with the Git server.","operationId":"handle_create_identity","responses":{"200":{"description":"Identity created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitIdentity"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}":{"delete":{"tags":["Git"],"summary":"Delete a Git identity","description":"Delete a Git identity. This will revoke all permissions granted to this identity.","operationId":"handle_delete_identity","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Identity deleted","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Identity not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}/permissions":{"get":{"tags":["Git"],"summary":"List repository permissions for an identity","description":"List repository permissions for an identity. This will return a list of repositories that the identity has access to.","operationId":"handle_list_permissions","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Maximum number of repositories to return","required":false,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"offset","in":"query","description":"Offset for the list of repositories","required":false,"schema":{"type":"integer","format":"int64","minimum":0}}],"responses":{"200":{"description":"Permission list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListPermissionResponseSuccess"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}/permissions/{repo}":{"get":{"tags":["Git"],"summary":"Get the permission of an identity on a repository","description":"Get the permission of an identity on a repository. This will return the access level of the identity on the repository.","operationId":"handle_describe_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Permission info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DescribePermissionResponseSuccess"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Grant a permission to a Git identity","description":"Grant a permission to a Git identity on a repository","operationId":"handle_grant_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantPermissionRequest"}}},"required":true},"responses":{"200":{"description":"Permission granted successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["Git"],"summary":"Revoke permissions from a Git identity","description":"Revoke a permission to a Git identity on a repository","operationId":"handle_revoke_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Permission revoked successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"patch":{"tags":["Git"],"summary":"Update a permission for a Git identity","description":"Update a permission for a Git identity on a repository","operationId":"handle_update_permission","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string"}},{"name":"repo","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePermissionRequest"}}},"required":true},"responses":{"200":{"description":"Permission updated successfully","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/identity/{identity}/tokens":{"get":{"tags":["Git"],"summary":"List access tokens for a Git identity","description":"List access tokens for a Git identity","operationId":"handle_list_git_tokens","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Token list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListGitTokensResponseSuccess"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Create an access token for a Git identity","description":"Create an access token for a Git identity","operationId":"handle_create_git_token","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Token created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedToken"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"delete":{"tags":["Git"],"summary":"Revoke an access token for a Git identity","description":"Revoke an access token for a Git identity","operationId":"handle_revoke_git_token","parameters":[{"name":"identity","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeGitTokenRequest"}}},"required":true},"responses":{"200":{"description":"Token revoked","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo":{"get":{"tags":["Git"],"summary":"List repositories","description":"List repositories.","operationId":"handle_list_repositories","parameters":[{"name":"limit","in":"query","description":"Maximum number of repositories to return","required":false,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"offset","in":"query","description":"Offset for the list of repositories","required":false,"schema":{"type":"integer","format":"int64","minimum":0}}],"responses":{"200":{"description":"List of repositories","content":{"application/json":{"schema":{"type":"object","required":["repositories","offset"],"properties":{"repositories":{"type":"array","items":{"$ref":"#/components/schemas/RepositoryInfo"}},"offset":{"type":"integer","format":"int64","minimum":0}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Create a repository","description":"Create a repository. Once the repository is created, it will also be created on the Git server.\nThe repository name must be unique within your account.\n\nOnce created, you can then push your code to this repository.\n\nThe repo will be available at `git.freestyle.sh/{repo-id}`\n","operationId":"handle_create_repo","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRepositoryRequest"}}},"required":true},"responses":{"200":{"description":"Repository created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRepositoryResponseSuccess"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}":{"delete":{"tags":["Git"],"summary":"Delete a repository","description":"Delete a repository. This is irreversible, and will also delete the repository on the Git server.","operationId":"handle_delete_repo","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Repository deleted successfully","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to delete this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository does not exist","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/trigger":{"get":{"tags":["Git"],"summary":"List git triggers for a repository","description":"List git triggers for the given repository.","operationId":"handle_list_git_triggers","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","required":["triggers"],"properties":{"triggers":{"type":"array","items":{"$ref":"#/components/schemas/GitRepositoryTrigger"}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to access this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository does not exist","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}},"post":{"tags":["Git"],"summary":"Create a git trigger","description":"Create a git trigger for the given repository.","operationId":"handle_create_git_trigger","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["trigger","action"],"properties":{"trigger":{"oneOf":[{"type":"object","required":["event"],"properties":{"branches":{"type":["array","null"],"items":{"type":"string"}},"globs":{"type":["array","null"],"items":{"type":"string"}},"event":{"type":"string","enum":["push"]}}}]},"action":{"oneOf":[{"type":"object","required":["endpoint","action"],"properties":{"endpoint":{"type":"string"},"action":{"type":"string","enum":["webhook"]}}}]}}}}},"required":true},"responses":{"200":{"description":"Trigger created successfully","content":{"application/json":{"schema":{"type":"object","required":["triggerId"],"properties":{"triggerId":{"type":"string"}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to create a trigger on this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository does not exist","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/git/v1/repo/{repo}/trigger/{trigger}":{"delete":{"tags":["Git"],"summary":"Delete a git trigger","description":"Delete a git trigger. This is irreversible.","operationId":"handle_delete_git_trigger","parameters":[{"name":"repo","in":"path","description":"The repository id","required":true,"schema":{"type":"string"}},{"name":"trigger","in":"path","description":"The trigger id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Trigger deleted successfully","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"403":{"description":"User does not have permission to delete a trigger on this repository","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"404":{"description":"Repository does not exist","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}},"/observability/v1/logs":{"get":{"tags":["Observability"],"summary":"Deployment Logs","description":"Get the logs for a deployment","operationId":"handle_get_logs","parameters":[{"name":"deploymentId","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"domain","in":"query","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleGetLogsResponse"}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.getLogs({\n deploymentId: 'deployment-id',\n}).then((response) => {\n console.log(response);\n});"}]}},"/web/v1/deploy":{"post":{"tags":["Web"],"summary":"Deploy a Website","description":"Deploy a website. Files is a map of file paths to file contents. Configuration is optional and contains additional information about the deployment.","operationId":"handle_deploy_web","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebPayload"}}},"required":true},"responses":{"200":{"description":"successfully deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebSuccessResponse"}}}},"400":{"description":"failed to deploy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreestyleDeployWebErrorResponse"}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\nimport 'dotenv/config';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .deployWeb({\n 'index.js': {\n content:`\n import http from 'node:http';\n console.log('starting server');\n\n const server = http.createServer(async(req, res) => {\n // wait 5 seconds before responding\n // await new Promise((resolve) => setTimeout(resolve, 5000));\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.end('Welcome to New York its been waiting for you');\n });\n\n server.listen(3000, () => {\n console.log('Server is running at http://localhost:3000');\n });`,\n }})\n .then((result) => {\n console.log('Deployed website @ ', result.deploymentId);\n });\n"},{"label":"Vercel AI SDK","lang":"javascript","source":"import { deployWebTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst deployer = deployWebTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n deployer,\n },\n maxSteps: 2,\n prompt:\n 'Deploy a website to subdomain.yourdomain.com that has all the lyrics to Sandstorm by Darude on the homepage',\n});"}]}},"/web/v1/deployments":{"get":{"tags":["Web"],"summary":"List web deploys","description":"List web deploys.","operationId":"handle_list_web_deploys","parameters":[{"name":"limit","in":"query","description":"Maximum number of repositories to return","required":true,"schema":{"type":"integer","format":"int64","minimum":0}},{"name":"offset","in":"query","description":"Offset for the list of repositories","required":true,"schema":{"type":"integer","format":"int64","minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["entries","total","offset"],"properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/DeploymentLogEntry"}},"total":{"type":"integer","format":"int64","minimum":0},"offset":{"type":"integer","format":"int64","minimum":0}}}}}},"500":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}},"x-codeSamples":[{"label":"JS SDK","lang":"javascript","source":"import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listWebDeploys().then((response) => {\n console.log(response);\n});"}]}},"/web/v1/deployments/deployment/{deployment_id}":{"get":{"tags":["Web"],"summary":"Get information on web deploy","description":"Get information about a web deploy by its ID.","operationId":"handle_get_web_deploy_details","parameters":[{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{}}}},"components":{"schemas":{"AccessLevel":{"type":"string","enum":["read","write"]},"AccessTokenInfo":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}}},"AccessibleRepository":{"type":"object","description":"Identical to [`RepositoryInfo`], but with the permissions field added.","required":["id","accountId","permissions","visibility"],"properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"accountId":{"type":"string"},"permissions":{"$ref":"#/components/schemas/AccessLevel"},"visibility":{"$ref":"#/components/schemas/Visibility"}}},"Behavior":{"type":"string","default":"exact","enum":["regex","exact"]},"CreateDomainMappingRequest":{"type":"object","required":["deploymentId"],"properties":{"deploymentId":{"type":"string"}}},"CreateRepositoryRequest":{"type":"object","properties":{"name":{"type":["string","null"],"description":"This name is not visible to users, and is only accessible to you via API and in the\ndashboard. Mostly useful for observability."},"public":{"type":"boolean","default":false}}},"CreateRepositoryResponseSuccess":{"type":"object","required":["repoId"],"properties":{"repoId":{"type":"string"}}},"CreatedToken":{"type":"object","required":["id","token"],"properties":{"id":{"type":"string"},"token":{"type":"string"}}},"DeploymentLogEntry":{"type":"object","required":["deploymentId","accountId","provisionedAt","timeout","state","domains","envVars"],"properties":{"deploymentId":{"type":"string","format":"uuid"},"accountId":{"type":"string"},"provisionedAt":{"type":"string","format":"date-time"},"timeout":{"type":"string"},"state":{"$ref":"#/components/schemas/DeploymentState"},"deployedAt":{"type":["string","null"],"format":"date-time"},"domains":{"type":"array","items":{"type":"string"}},"envVars":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}}}},"DeploymentState":{"type":"string","enum":["provisioning","deployed","failed"]},"DescribePermissionResponseSuccess":{"type":"object","required":["identity","repo"],"properties":{"identity":{"type":"string"},"repo":{"type":"string"},"accessLevel":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AccessLevel"}]}}},"DnsRecord":{"type":"object","required":["kind","name","value","ttl","managed"],"properties":{"kind":{"$ref":"#/components/schemas/DnsRecordKind"},"name":{"type":"string"},"value":{"type":"string"},"ttl":{"type":"string"},"priority":{"type":["integer","null"],"format":"int32","minimum":0},"managed":{"type":"boolean"}}},"DnsRecordKind":{"type":"string","enum":["A","AAAA","CNAME","TXT","NS"]},"DomainVerificationRequest":{"type":"object","required":["id","domain","accountId","verificationCode","createdAt"],"properties":{"id":{"type":"string","example":"1234-5678-9012-3456"},"domain":{"type":"string","example":"example.com"},"accountId":{"type":"string","example":"1234-5678-9012-3456"},"verificationCode":{"type":"string","example":"freestyle-verification-v1-1234-5678-9012-3456"},"createdAt":{"type":"integer","format":"int64","example":"1234567890"}}},"ExecuteLogEntry":{"type":"object","required":["deployment","accountId","provisionedAt","state","envVars"],"properties":{"deployment":{"type":"string","format":"uuid"},"accountId":{"type":"string"},"provisionedAt":{"type":"string","format":"date-time"},"startedAt":{"type":["string","null"],"format":"date-time"},"duration":{"type":["string","null"]},"state":{"$ref":"#/components/schemas/ExecuteRunState"},"envVars":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}}}},"ExecuteRunInfo":{"type":"object","required":["code","nodeModules"],"properties":{"code":{"type":"string"},"nodeModules":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}}}},"ExecuteRunState":{"type":"string","enum":["starting","running","complete"]},"FreestyleCloudstateDeployConfiguration":{"type":"object","properties":{"domains":{"type":["array","null"],"items":{"type":"string"},"description":"ID of the project to deploy, if not provided will create a new project","default":null},"envVars":{"type":"object","description":"The environment variables that the cloudstate deploy can access","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"}},"cloudstateDatabaseId":{"type":["string","null"],"default":null}}},"FreestyleCloudstateDeployErrorResponse":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}},"FreestyleCloudstateDeployRequest":{"type":"object","required":["classes"],"properties":{"classes":{"type":"string"},"config":{"$ref":"#/components/schemas/FreestyleCloudstateDeployConfiguration"}}},"FreestyleCloudstateDeploySuccessResponse":{"type":"object","required":["deploymentId","cloudstateDatabaseId"],"properties":{"deploymentId":{"type":"string"},"cloudstateDatabaseId":{"type":"string"}}},"FreestyleDeleteDomainVerificationRequest":{"type":"object","required":["domain","verificationCode"],"properties":{"domain":{"type":"string","description":"The domain to create a verification code for","example":"example.com"},"verificationCode":{"type":"string","description":"The verification code"}}},"FreestyleDeployWebConfiguration":{"type":"object","properties":{"entrypoint":{"type":["string","null"],"description":"The entrypoint file for the website","default":"index.js"},"domains":{"type":["array","null"],"items":{"type":"string"},"description":"The custom domains for the website, eg. [\\\"subdomain.yourwebsite.com\\\"]. You may include a single *.style.dev domain here.","example":["subdomain.yourdomain.com"],"default":null},"projectId":{"type":["string","null"],"description":"Project ID was our original way of tracking deployments together, it is now deprecated and will be removed in the future. Please use the domains field to specify the domains for your project.","default":null,"deprecated":true},"nodeModules":{"type":["object","null"],"description":"Node Modules to install for the website, a map of package names to versions, e.g. { \\\"express\\\": \\\"4.17.1\\\" }. If this and a package-lock.json are provided, the package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock is also provided, the versions here will override the versions in those lock files.","default":null,"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"resend":"4.0.1"}},"envVars":{"type":["object","null"],"description":"The environment variables that the website can access\ne.g. { \\\"RESEND_API_KEY\\\": \\\"re_123456789\\\" }","default":null,"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"RESEND_API_KEY":"re_123456789"}},"serverStartCheck":{"type":"boolean","default":false},"networkPermissions":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FreestyleNetworkPermission"},"default":null}}},"FreestyleDeployWebErrorResponse":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}},"FreestyleDeployWebPayload":{"type":"object","required":["files"],"properties":{"files":{"type":"object","description":"The files to deploy, a map of file paths to file contents, e.g. { \\\"index.js\\\": {\\\"content\\\": \\\"your main\\\", \\\"encoding\\\": \\\"utf-8\\\"}, \\\"file2.js\\\": {\\\"content\\\": \\\"your helper\\\" } }\n\n**Do not include node modules in this bundle, they will not work**. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install.","additionalProperties":{"$ref":"#/components/schemas/FreestyleFile"},"propertyNames":{"type":"string"},"example":{"index.js":{"content":"import http from 'node:http';\\n// import { resolver } from './file2.js';\\n\\nconsole.log('starting server');\\n\\nconst server = http.createServer(async(req, res) => {\\n // wait 5 seconds before responding\\n // await new Promise((resolve) => setTimeout(resolve, 5000));\\n res.writeHead(200, { 'Content-Type': 'text/plain' });\\n res.end('Welcome to New York its been waiting for you');\\n});\\n\\nserver.listen(3000, () => {\\n console.log('Server is running at http://localhost:3000');\\n});"}}},"config":{"$ref":"#/components/schemas/FreestyleDeployWebConfiguration"}}},"FreestyleDeployWebSuccessResponse":{"type":"object","required":["deploymentId"],"properties":{"deploymentId":{"type":"string"},"domains":{"type":["array","null"],"items":{"type":"string"}},"projectId":{"type":["string","null"],"deprecated":true}}},"FreestyleDomainVerificationRequest":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","description":"The domain to create a verification code for","example":"example.com"}}},"FreestyleExecuteScriptParams":{"type":"object","required":["script"],"properties":{"script":{"type":"string","description":"The JavaScript or TypeScript script to execute","example":"export default () => {\n // get the value of the factorials of the numbers from 1 to 10 combined\n const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n\n function factorial(n) {\n if (n === 0) {\n return 1;\n }\n return n * factorial(n - 1);\n }\n\n const b = a.map(factorial);\n\n return b.reduce((a, b) => a + b);\n};\n"},"config":{"$ref":"#/components/schemas/FreestyleExecuteScriptParamsConfiguration"}}},"FreestyleExecuteScriptParamsConfiguration":{"type":"object","properties":{"envVars":{"type":"object","description":"The environment variables to set for the script","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"RESEND_API_KEY":"re_123456789"}},"nodeModules":{"type":"object","description":"The node modules to install for the script","default":{},"additionalProperties":{"type":"string"},"propertyNames":{"type":"string"},"example":{"resend":"4.0.1"}},"tags":{"type":"array","items":{"type":"string"},"description":"Tags for you to organize your scripts, useful for tracking what you're running","example":["email"],"default":[]},"timeout":{"type":["string","null"],"description":"The script timeout","default":null},"peerDependencyResolution":{"type":"boolean","description":"If false, we'll not resolve peer dependencies for the packages given, this can speed up execute performance, but will break packages with peers unless the peers are manually specified.","default":true},"networkPermissions":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FreestyleNetworkPermission"},"default":null}}},"FreestyleExecuteScriptResultSuccess":{"type":"object","required":["result","logs"],"properties":{"result":{"description":"The return value of the default export of the script"},"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}},"FreestyleFile":{"type":"object","required":["content"],"properties":{"content":{"type":"string","description":"The content of the file"},"encoding":{"type":"string","description":"The encoding of the file. Either **utf-8** or **base64**"}}},"FreestyleGetLogsResponse":{"type":"object","required":["logs"],"properties":{"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleLogResponseObject"}}}},"FreestyleJavaScriptLog":{"type":"object","required":["message","type"],"properties":{"message":{"type":"string","description":"The log message","example":"I'm a log!"},"type":{"type":"string","description":"The log level","example":"log"}}},"FreestyleLogResponseObject":{"type":"object","required":["message","timestamp"],"properties":{"message":{"type":"string"},"timestamp":{"type":"string"}}},"FreestyleNetworkPermission":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/NetworkPermissionData"},{"type":"object","required":["action"],"properties":{"action":{"type":"string","enum":["allow"]}}}]},{"allOf":[{"$ref":"#/components/schemas/NetworkPermissionData"},{"type":"object","required":["action"],"properties":{"action":{"type":"string","enum":["deny"]}}}]}]},"FreestyleVerifyDomainRequest":{"oneOf":[{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"example.com"}}},{"type":"object","required":["id"],"properties":{"id":{"type":"string","example":"1234-5678-9012-3456"}}}],"description":"Verify a domain verification request, can either be done for a domain, or for a specific request"},"GitIdentity":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}}},"GitRepositoryTrigger":{"type":"object","required":["repositoryId","trigger","action","managed","id","createdAt"],"properties":{"repositoryId":{"type":"string"},"trigger":{"oneOf":[{"type":"object","required":["event"],"properties":{"branches":{"type":["array","null"],"items":{"type":"string"}},"globs":{"type":["array","null"],"items":{"type":"string"}},"event":{"type":"string","enum":["push"]}}}]},"action":{"oneOf":[{"type":"object","required":["endpoint","action"],"properties":{"endpoint":{"type":"string"},"action":{"type":"string","enum":["webhook"]}}}]},"managed":{"type":"boolean"},"id":{"type":"string"},"createdAt":{"type":"integer","format":"int64"}}},"GitTrigger":{"oneOf":[{"type":"object","required":["event"],"properties":{"branches":{"type":["array","null"],"items":{"type":"string"}},"globs":{"type":["array","null"],"items":{"type":"string"}},"event":{"type":"string","enum":["push"]}}}]},"GitTriggerAction":{"oneOf":[{"type":"object","required":["endpoint","action"],"properties":{"endpoint":{"type":"string"},"action":{"type":"string","enum":["webhook"]}}}]},"GrantPermissionRequest":{"type":"object","required":["permission"],"properties":{"permission":{"$ref":"#/components/schemas/AccessLevel"}}},"ListGitTokensResponseSuccess":{"type":"object","required":["tokens"],"properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/AccessTokenInfo"}}}},"ListPermissionResponseSuccess":{"type":"object","required":["repositories"],"properties":{"repositories":{"type":"array","items":{"$ref":"#/components/schemas/AccessibleRepository"}}}},"ListRecordsResponse":{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/DnsRecord"}}}},"NetworkPermissionData":{"type":"object","required":["query"],"properties":{"query":{"type":"string"},"behavior":{"$ref":"#/components/schemas/Behavior"}}},"RepositoryInfo":{"type":"object","required":["id","accountId","visibility"],"properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"accountId":{"type":"string"},"visibility":{"$ref":"#/components/schemas/Visibility"}}},"RevokeGitTokenRequest":{"type":"object","required":["tokenId"],"properties":{"tokenId":{"type":"string"}}},"UpdatePermissionRequest":{"type":"object","required":["permission"],"properties":{"permission":{"$ref":"#/components/schemas/AccessLevel"}}},"Visibility":{"type":"string","enum":["public","private"]}},"responses":{"FreestyleExecuteScriptResultSuccess":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["result","logs"],"properties":{"result":{"description":"The return value of the default export of the script"},"logs":{"type":"array","items":{"$ref":"#/components/schemas/FreestyleJavaScriptLog"}}}}}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Web","description":"APIs for deploying websites. We handle node modules caching, scaling, certificates and the whole end to end process. Send the code using the [deploy](#tag/web/POST/web/v1/deploy) endpoint, and you'll get a full hosted website back. Works with any TypeScript or JavaScript codebase."},{"name":"Execute","description":"APIs for running code. Send the code using the [execute](#tag/execute/POST/execute/v1/execute) endpoint, and you'll get the output back. Works with any TypeScript or JavaScript code + handles any node modules and environment variables you want."},{"name":"Cloudstate","description":"APIs for running cloud functions with persistent state. [Cloudstate](https://github.com/freestyle-sh/cloudstate/) is an opensource, durable JavaScript runtime maintained by the Freestyle Team."},{"name":"Domains","description":"APIs for managing domains. This is only relevant when you want to start to deploy to custom domains. \nPlease read [this guide](https://github.com/freestyle-sh/sandbox_sdks/blob/main/docs/custom_domains.md) to understand how deployments work with custom domains."},{"name":"Git","description":"APIs for managing git repositories."},{"name":"DNS","description":"APIs for managing DNS records. WIP."}]}
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "Freestyle Sandboxes",
5
+ "description": "\nFreestyle Sandboxes lets you deploy your users or AIs code. **Get your API Key at [admin.freestyle.sh](https://admin.freestyle.sh)**\n\nThey are broken up into core 5 categories: [Web](#tag/web), [Execute](#tag/execute), [Cloudstate](#tag/cloudstate), [Git](#tag/git), and [Domains](#tag/domains).\n\n[Web](#tag/web): Send us the code for the website, we'll provision the certificates and get it hosted\n\n[Execute](#tag/execute): Send us a function, we'll run it and send you the output\n\n[Cloudstate](#tag/cloudstate): Our Opensource JavaScript Runtime used for cloud functions with persistent state\n\n[Domains](#tag/domains): Manage your domains, including verification and listing\n\n[Git](#tag/git): Manage your git repositories\n",
6
+ "contact": { "name": "Ben", "email": "ben@freestyle.sh" },
7
+ "license": { "name": "" },
8
+ "version": "0.1.0"
9
+ },
10
+ "servers": [
11
+ { "url": "https://api.freestyle.sh", "description": "Production" },
12
+ { "url": "http://localhost:8080", "description": "Development server" }
13
+ ],
14
+ "paths": {
15
+ "/cloudstate/v1/deploy": {
16
+ "post": {
17
+ "tags": ["Cloudstate"],
18
+ "summary": "Deploy Cloudstate Project",
19
+ "description": "Deploy a cloudstate project",
20
+ "operationId": "handle_deploy_cloudstate",
21
+ "requestBody": {
22
+ "content": {
23
+ "application/json": {
24
+ "schema": {
25
+ "$ref": "#/components/schemas/FreestyleCloudstateDeployRequest"
26
+ }
27
+ }
28
+ },
29
+ "required": true
30
+ },
31
+ "responses": {
32
+ "200": {
33
+ "description": "successfully deployed",
34
+ "content": {
35
+ "application/json": {
36
+ "schema": {
37
+ "$ref": "#/components/schemas/FreestyleCloudstateDeploySuccessResponse"
38
+ }
39
+ }
40
+ }
41
+ },
42
+ "500": {
43
+ "description": "failed to deploy",
44
+ "content": {
45
+ "application/json": {
46
+ "schema": {
47
+ "$ref": "#/components/schemas/FreestyleCloudstateDeployErrorResponse"
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ },
55
+ "/cloudstate/v1/projects/{id}/backup": {
56
+ "get": {
57
+ "tags": ["Cloudstate"],
58
+ "summary": "Get Backup of Cloudstate Project",
59
+ "description": "Get a backup of a cloudstate project",
60
+ "operationId": "handle_backup_cloudstate",
61
+ "parameters": [
62
+ {
63
+ "name": "id",
64
+ "in": "path",
65
+ "required": true,
66
+ "schema": { "type": "string" }
67
+ }
68
+ ],
69
+ "responses": {
70
+ "200": {
71
+ "description": "successfully backed up",
72
+ "content": {
73
+ "application/octet-stream": {
74
+ "schema": {
75
+ "type": "array",
76
+ "items": {
77
+ "type": "integer",
78
+ "format": "int32",
79
+ "minimum": 0
80
+ }
81
+ }
82
+ }
83
+ }
84
+ },
85
+ "500": { "description": "failed to backup" }
86
+ }
87
+ }
88
+ },
89
+ "/dns/v1/records": {
90
+ "get": {
91
+ "tags": ["DNS"],
92
+ "summary": "List DNS Records",
93
+ "operationId": "handle_list_records",
94
+ "parameters": [
95
+ {
96
+ "name": "domain",
97
+ "in": "query",
98
+ "required": true,
99
+ "schema": { "type": "string" },
100
+ "example": "example.com"
101
+ }
102
+ ],
103
+ "responses": {
104
+ "200": {
105
+ "description": "",
106
+ "content": {
107
+ "application/json": {
108
+ "schema": { "$ref": "#/components/schemas/ListRecordsResponse" }
109
+ }
110
+ }
111
+ },
112
+ "400": {
113
+ "description": "",
114
+ "content": {
115
+ "application/json": {
116
+ "schema": {
117
+ "type": "object",
118
+ "required": ["message"],
119
+ "properties": { "message": { "type": "string" } }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+ },
126
+ "post": {
127
+ "tags": ["DNS"],
128
+ "summary": "Create DNS Record",
129
+ "operationId": "handle_create_record",
130
+ "parameters": [
131
+ {
132
+ "name": "domain",
133
+ "in": "query",
134
+ "required": true,
135
+ "schema": { "type": "string" }
136
+ },
137
+ {
138
+ "name": "record",
139
+ "in": "query",
140
+ "required": true,
141
+ "schema": { "$ref": "#/components/schemas/DnsRecord" }
142
+ }
143
+ ],
144
+ "responses": {
145
+ "200": {
146
+ "description": "",
147
+ "content": {
148
+ "application/json": {
149
+ "schema": {
150
+ "type": "object",
151
+ "required": ["record"],
152
+ "properties": {
153
+ "record": { "$ref": "#/components/schemas/DnsRecord" }
154
+ }
155
+ }
156
+ }
157
+ }
158
+ },
159
+ "400": {
160
+ "description": "",
161
+ "content": {
162
+ "application/json": {
163
+ "schema": {
164
+ "type": "object",
165
+ "required": ["message"],
166
+ "properties": { "message": { "type": "string" } }
167
+ }
168
+ }
169
+ }
170
+ }
171
+ }
172
+ },
173
+ "delete": {
174
+ "tags": ["DNS"],
175
+ "summary": "Delete DNS Record",
176
+ "operationId": "handle_delete_record",
177
+ "parameters": [
178
+ {
179
+ "name": "domain",
180
+ "in": "query",
181
+ "required": true,
182
+ "schema": { "type": "string" },
183
+ "example": "example.com"
184
+ },
185
+ {
186
+ "name": "record",
187
+ "in": "query",
188
+ "required": true,
189
+ "schema": { "$ref": "#/components/schemas/DnsRecord" }
190
+ }
191
+ ],
192
+ "responses": {
193
+ "200": {
194
+ "description": "",
195
+ "content": {
196
+ "application/json": {
197
+ "schema": {
198
+ "type": "object",
199
+ "required": ["message"],
200
+ "properties": { "message": { "type": "string" } }
201
+ }
202
+ }
203
+ }
204
+ },
205
+ "400": {
206
+ "description": "",
207
+ "content": {
208
+ "application/json": {
209
+ "schema": {
210
+ "type": "object",
211
+ "required": ["message"],
212
+ "properties": { "message": { "type": "string" } }
213
+ }
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+ },
220
+ "/domains/v1/certs/{domain}/wildcard": {
221
+ "post": {
222
+ "tags": ["Certs", "Domains"],
223
+ "summary": "Provision a wildcard certificate",
224
+ "description": "Provisions a wildcard certificate for a verified domain\n\n\nThis speeds up deploys on all subdomains of the domain. In order to use it, you must add the following record to your DNS config:\n\n`_acme-challenge.yourdomain.com` NS `dns.freestyle.sh`",
225
+ "operationId": "handle_verify_wildcard",
226
+ "parameters": [
227
+ {
228
+ "name": "domain",
229
+ "in": "path",
230
+ "required": true,
231
+ "schema": { "type": "string" }
232
+ }
233
+ ],
234
+ "responses": {
235
+ "200": {
236
+ "description": "Domain verified",
237
+ "content": {
238
+ "application/json": {
239
+ "schema": {
240
+ "type": "object",
241
+ "required": ["domain"],
242
+ "properties": {
243
+ "domain": { "type": "string", "example": "example.com" }
244
+ }
245
+ }
246
+ }
247
+ }
248
+ },
249
+ "400": {
250
+ "description": "Failed to preverify domain",
251
+ "content": {
252
+ "application/json": {
253
+ "schema": {
254
+ "type": "object",
255
+ "required": ["message"],
256
+ "properties": { "message": { "type": "string" } }
257
+ }
258
+ }
259
+ }
260
+ }
261
+ },
262
+ "x-codeSamples": [
263
+ {
264
+ "label": "JS SDK",
265
+ "lang": "javascript",
266
+ "source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.provisionWildcard('example.com').then((cert) => {\n console.log(cert);\n});"
267
+ }
268
+ ]
269
+ }
270
+ },
271
+ "/domains/v1/domains": {
272
+ "get": {
273
+ "tags": ["Domains"],
274
+ "summary": "List domains for an account",
275
+ "description": "This lists the domains that an account has verified ownership of. This includes the *.style.dev domains the account has claimed.",
276
+ "operationId": "handle_list_domains",
277
+ "responses": {
278
+ "200": {
279
+ "description": "List of domains",
280
+ "content": {
281
+ "application/json": {
282
+ "schema": {
283
+ "type": "array",
284
+ "items": {
285
+ "type": "object",
286
+ "required": ["domain", "createdAt"],
287
+ "properties": {
288
+ "domain": {
289
+ "type": "string",
290
+ "example": "example.yourdomain.com"
291
+ },
292
+ "createdAt": { "type": "integer", "format": "int64" }
293
+ }
294
+ }
295
+ }
296
+ }
297
+ }
298
+ },
299
+ "400": {
300
+ "description": "Failed to get domains",
301
+ "content": {
302
+ "application/json": {
303
+ "schema": {
304
+ "type": "object",
305
+ "required": ["message"],
306
+ "properties": { "message": { "type": "string" } }
307
+ }
308
+ }
309
+ }
310
+ }
311
+ },
312
+ "x-codeSamples": [
313
+ {
314
+ "label": "JS SDK",
315
+ "lang": "javascript",
316
+ "source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listDomains().then((response) => {\n console.log(response);\n});"
317
+ }
318
+ ]
319
+ }
320
+ },
321
+ "/domains/v1/mappings/{domain}": {
322
+ "post": {
323
+ "tags": ["Domains"],
324
+ "summary": "Insert Domain Mapping",
325
+ "description": "This will unmap any other deployment to this domain",
326
+ "operationId": "handle_insert_domain_mapping",
327
+ "parameters": [
328
+ {
329
+ "name": "domain",
330
+ "in": "path",
331
+ "required": true,
332
+ "schema": { "type": "string" }
333
+ }
334
+ ],
335
+ "requestBody": {
336
+ "content": {
337
+ "application/json": {
338
+ "schema": {
339
+ "$ref": "#/components/schemas/CreateDomainMappingRequest"
340
+ }
341
+ }
342
+ },
343
+ "required": true
344
+ },
345
+ "responses": {
346
+ "200": { "description": "Successfully mapped domain to deployment" },
347
+ "401": {
348
+ "description": "You do not have permission to do this",
349
+ "content": {
350
+ "application/json": {
351
+ "schema": {
352
+ "type": "object",
353
+ "required": ["message"],
354
+ "properties": { "message": { "type": "string" } }
355
+ }
356
+ }
357
+ }
358
+ },
359
+ "422": {
360
+ "description": "Failed to provision certificate",
361
+ "content": {
362
+ "application/json": {
363
+ "schema": {
364
+ "type": "object",
365
+ "required": ["message"],
366
+ "properties": { "message": { "type": "string" } }
367
+ }
368
+ }
369
+ }
370
+ },
371
+ "500": {
372
+ "description": "Failed to insert ownership",
373
+ "content": {
374
+ "application/json": {
375
+ "schema": {
376
+ "type": "object",
377
+ "required": ["message"],
378
+ "properties": { "message": { "type": "string" } }
379
+ }
380
+ }
381
+ }
382
+ },
383
+ "502": {
384
+ "description": "Failed to check permissions",
385
+ "content": {
386
+ "application/json": {
387
+ "schema": {
388
+ "type": "object",
389
+ "required": ["message"],
390
+ "properties": { "message": { "type": "string" } }
391
+ }
392
+ }
393
+ }
394
+ }
395
+ }
396
+ },
397
+ "delete": {
398
+ "tags": ["Domains"],
399
+ "summary": "Remove Domain Mapping",
400
+ "operationId": "handle_delete_domain_mapping",
401
+ "parameters": [
402
+ {
403
+ "name": "domain",
404
+ "in": "path",
405
+ "required": true,
406
+ "schema": { "type": "string" }
407
+ }
408
+ ],
409
+ "responses": {
410
+ "200": {
411
+ "description": "Successfully removed domain mapping to deployment"
412
+ },
413
+ "401": {
414
+ "description": "You do not have permission to do this",
415
+ "content": {
416
+ "application/json": {
417
+ "schema": {
418
+ "type": "object",
419
+ "required": ["message"],
420
+ "properties": { "message": { "type": "string" } }
421
+ }
422
+ }
423
+ }
424
+ },
425
+ "500": {
426
+ "description": "Failed to insert ownership",
427
+ "content": {
428
+ "application/json": {
429
+ "schema": {
430
+ "type": "object",
431
+ "required": ["message"],
432
+ "properties": { "message": { "type": "string" } }
433
+ }
434
+ }
435
+ }
436
+ },
437
+ "502": {
438
+ "description": "Failed to check permissions",
439
+ "content": {
440
+ "application/json": {
441
+ "schema": {
442
+ "type": "object",
443
+ "required": ["message"],
444
+ "properties": { "message": { "type": "string" } }
445
+ }
446
+ }
447
+ }
448
+ }
449
+ }
450
+ }
451
+ },
452
+ "/domains/v1/verifications": {
453
+ "get": {
454
+ "tags": ["Domains"],
455
+ "summary": "List domain verification requests for an account",
456
+ "description": "Lists domain verification requests for the current account.",
457
+ "operationId": "handle_list_domain_verification_requests",
458
+ "responses": {
459
+ "200": {
460
+ "description": "List of verification codes",
461
+ "content": {
462
+ "application/json": {
463
+ "schema": {
464
+ "type": "array",
465
+ "items": {
466
+ "type": "object",
467
+ "required": ["verificationCode", "domain", "createdAt"],
468
+ "properties": {
469
+ "verificationCode": { "type": "string" },
470
+ "domain": { "type": "string" },
471
+ "createdAt": { "type": "integer", "format": "int64" }
472
+ }
473
+ }
474
+ }
475
+ }
476
+ }
477
+ },
478
+ "400": {
479
+ "description": "Failed to get verification codes",
480
+ "content": {
481
+ "application/json": {
482
+ "schema": {
483
+ "type": "object",
484
+ "required": ["message"],
485
+ "properties": { "message": { "type": "string" } }
486
+ }
487
+ }
488
+ }
489
+ }
490
+ },
491
+ "x-codeSamples": [
492
+ {
493
+ "label": "JS SDK",
494
+ "lang": "javascript",
495
+ "source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listDomainVerificationRequests().then((response) => {\n console.log(response);\n});"
496
+ }
497
+ ]
498
+ },
499
+ "put": {
500
+ "tags": ["Domains"],
501
+ "summary": "Verify a domain verification request",
502
+ "description": "This checks a pre-existing verification request for a domain. To create a verification request, call the [create domain verification](/#tag/domains/POST/domains/v1/verifications) endpoint. This endpoint will check if the domain has a TXT record with the verification code. If it does, the domain will be verified.",
503
+ "operationId": "handle_verify_domain",
504
+ "requestBody": {
505
+ "content": {
506
+ "application/json": {
507
+ "schema": {
508
+ "$ref": "#/components/schemas/FreestyleVerifyDomainRequest"
509
+ }
510
+ }
511
+ },
512
+ "required": true
513
+ },
514
+ "responses": {
515
+ "200": {
516
+ "description": "Domain verified",
517
+ "content": {
518
+ "application/json": {
519
+ "schema": {
520
+ "type": "object",
521
+ "required": ["domain"],
522
+ "properties": {
523
+ "domain": { "type": "string", "example": "example.com" }
524
+ }
525
+ }
526
+ }
527
+ }
528
+ },
529
+ "400": {
530
+ "description": "Failed to verify domain",
531
+ "content": {
532
+ "application/json": {
533
+ "schema": {
534
+ "type": "object",
535
+ "required": ["message"],
536
+ "properties": { "message": { "type": "string" } }
537
+ }
538
+ }
539
+ }
540
+ },
541
+ "404": {
542
+ "description": "Domain verification request not found",
543
+ "content": {
544
+ "application/json": {
545
+ "schema": {
546
+ "type": "object",
547
+ "required": ["message"],
548
+ "properties": { "message": { "type": "string" } }
549
+ }
550
+ }
551
+ }
552
+ }
553
+ },
554
+ "x-codeSamples": [
555
+ {
556
+ "label": "JS SDK",
557
+ "lang": "javascript",
558
+ "source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .verifyDomain('example.com')\n .then((result) => {\n console.log('Successfully Verified Domain!');\n })\n .catch((error) => {\n console.error('Failed to verify domain: ', error);\n });"
559
+ }
560
+ ]
561
+ },
562
+ "post": {
563
+ "tags": ["Domains"],
564
+ "summary": "Create a domain verification request",
565
+ "description": "This creates a Freestyle Domain Verification Request. It returns a `verificationCode` for your domain. You need to place this code in a TXT record at `_freestyle_custom_hostname.thedomain.com`, then call the [verify domain](/#tag/domains/PUT/domains/v1/verifications) endpoint with the domain to verify it.",
566
+ "operationId": "handle_create_domain_verification",
567
+ "requestBody": {
568
+ "content": {
569
+ "application/json": {
570
+ "schema": {
571
+ "$ref": "#/components/schemas/FreestyleDomainVerificationRequest"
572
+ }
573
+ }
574
+ },
575
+ "required": true
576
+ },
577
+ "responses": {
578
+ "200": {
579
+ "description": "Verification code created",
580
+ "content": {
581
+ "application/json": {
582
+ "schema": {
583
+ "$ref": "#/components/schemas/DomainVerificationRequest"
584
+ }
585
+ }
586
+ }
587
+ },
588
+ "400": {
589
+ "description": "Failed to create verification code",
590
+ "content": {
591
+ "application/json": {
592
+ "schema": {
593
+ "type": "object",
594
+ "required": ["message"],
595
+ "properties": { "message": { "type": "string" } }
596
+ }
597
+ }
598
+ }
599
+ }
600
+ },
601
+ "x-codeSamples": [
602
+ {
603
+ "label": "JS SDK",
604
+ "lang": "javascript",
605
+ "source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi.createDomainVerificationRequest('example.com').then((result) => {\n const verificationCode = result.verificationCode;\n // put this at a TXT record at _freestyle_custom_hostname.example.com\n});"
606
+ }
607
+ ]
608
+ },
609
+ "delete": {
610
+ "tags": ["Domains"],
611
+ "summary": "Delete a domain verification request",
612
+ "description": "This deletes a Freestyle Domain Verification Request. This does not remove the domain from the account if it has already been verified, however the verification code will no longer be valid.",
613
+ "operationId": "handle_delete_domain_verification",
614
+ "requestBody": {
615
+ "content": {
616
+ "application/json": {
617
+ "schema": {
618
+ "$ref": "#/components/schemas/FreestyleDeleteDomainVerificationRequest"
619
+ }
620
+ }
621
+ },
622
+ "required": true
623
+ },
624
+ "responses": {
625
+ "200": {
626
+ "description": "Verification code created",
627
+ "content": {
628
+ "application/json": {
629
+ "schema": {
630
+ "type": "object",
631
+ "required": ["verificationCode", "domain"],
632
+ "properties": {
633
+ "verificationCode": { "type": "string" },
634
+ "domain": { "type": "string", "example": "example.com" }
635
+ }
636
+ }
637
+ }
638
+ }
639
+ },
640
+ "400": {
641
+ "description": "Failed to create verification code",
642
+ "content": {
643
+ "application/json": {
644
+ "schema": {
645
+ "type": "object",
646
+ "required": ["message"],
647
+ "properties": { "message": { "type": "string" } }
648
+ }
649
+ }
650
+ }
651
+ }
652
+ }
653
+ }
654
+ },
655
+ "/execute/v1/deployments": {
656
+ "get": {
657
+ "tags": ["Execute"],
658
+ "summary": "List execute runs",
659
+ "description": "List execute runs.",
660
+ "operationId": "handle_list_execute_runs",
661
+ "parameters": [
662
+ {
663
+ "name": "limit",
664
+ "in": "query",
665
+ "required": false,
666
+ "schema": { "type": ["integer", "null"], "minimum": 0 }
667
+ },
668
+ {
669
+ "name": "offset",
670
+ "in": "query",
671
+ "required": false,
672
+ "schema": { "type": ["integer", "null"], "minimum": 0 }
673
+ }
674
+ ],
675
+ "responses": {
676
+ "200": {
677
+ "description": "",
678
+ "content": {
679
+ "application/json": {
680
+ "schema": {
681
+ "type": "object",
682
+ "required": ["entries", "total", "offset"],
683
+ "properties": {
684
+ "entries": {
685
+ "type": "array",
686
+ "items": {
687
+ "$ref": "#/components/schemas/ExecuteLogEntry"
688
+ }
689
+ },
690
+ "total": {
691
+ "type": "integer",
692
+ "format": "int64",
693
+ "minimum": 0
694
+ },
695
+ "offset": {
696
+ "type": "integer",
697
+ "format": "int64",
698
+ "minimum": 0
699
+ }
700
+ }
701
+ }
702
+ }
703
+ }
704
+ },
705
+ "500": {
706
+ "description": "",
707
+ "content": {
708
+ "application/json": {
709
+ "schema": {
710
+ "type": "object",
711
+ "required": ["message"],
712
+ "properties": { "message": { "type": "string" } }
713
+ }
714
+ }
715
+ }
716
+ }
717
+ },
718
+ "x-codeSamples": [
719
+ {
720
+ "label": "JS SDK",
721
+ "lang": "javascript",
722
+ "source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listExecuteRuns().then((runs) => {\n console.log(runs);\n});"
723
+ }
724
+ ]
725
+ }
726
+ },
727
+ "/execute/v1/deployments/{deployment}": {
728
+ "get": {
729
+ "tags": ["Execute"],
730
+ "summary": "Get information on execute run",
731
+ "description": "Get information on execute run",
732
+ "operationId": "handle_get_execute_run",
733
+ "parameters": [
734
+ {
735
+ "name": "deployment",
736
+ "in": "path",
737
+ "required": true,
738
+ "schema": { "type": "string" }
739
+ }
740
+ ],
741
+ "responses": {
742
+ "200": {
743
+ "description": "Success",
744
+ "content": {
745
+ "application/json": {
746
+ "schema": {
747
+ "type": "object",
748
+ "required": ["metadata", "code"],
749
+ "properties": {
750
+ "metadata": {
751
+ "$ref": "#/components/schemas/ExecuteLogEntry"
752
+ },
753
+ "code": { "$ref": "#/components/schemas/ExecuteRunInfo" }
754
+ }
755
+ }
756
+ }
757
+ }
758
+ },
759
+ "401": {
760
+ "description": "Unauthorized access",
761
+ "content": {
762
+ "application/json": {
763
+ "schema": {
764
+ "type": "object",
765
+ "description": "Unauthorized access",
766
+ "required": ["message"],
767
+ "properties": { "message": { "type": "string" } }
768
+ }
769
+ }
770
+ }
771
+ },
772
+ "404": {
773
+ "description": "Not found",
774
+ "content": {
775
+ "application/json": {
776
+ "schema": {
777
+ "type": "object",
778
+ "description": "Not found",
779
+ "required": ["message"],
780
+ "properties": { "message": { "type": "string" } }
781
+ }
782
+ }
783
+ }
784
+ },
785
+ "500": {
786
+ "description": "Internal server error",
787
+ "content": {
788
+ "application/json": {
789
+ "schema": {
790
+ "type": "object",
791
+ "description": "Internal server error",
792
+ "required": ["message"],
793
+ "properties": { "message": { "type": "string" } }
794
+ }
795
+ }
796
+ }
797
+ }
798
+ },
799
+ "x-codeSamples": [
800
+ {
801
+ "label": "JS SDK",
802
+ "lang": "javascript",
803
+ "source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.getExecuteRun('123e4567-e89b-12d3-a456-426614174000').then((runs) => {\n console.log(runs);\n});"
804
+ }
805
+ ]
806
+ }
807
+ },
808
+ "/execute/v1/script": {
809
+ "post": {
810
+ "tags": ["Execute"],
811
+ "summary": "Execute Code",
812
+ "description": "Send a TypeScript or JavaScript module, get the result",
813
+ "operationId": "handle_execute_script",
814
+ "requestBody": {
815
+ "content": {
816
+ "application/json": {
817
+ "schema": {
818
+ "$ref": "#/components/schemas/FreestyleExecuteScriptParams"
819
+ }
820
+ }
821
+ },
822
+ "required": true
823
+ },
824
+ "responses": {
825
+ "200": {
826
+ "description": "Success",
827
+ "content": {
828
+ "application/json": {
829
+ "schema": {
830
+ "type": "object",
831
+ "required": ["result", "logs"],
832
+ "properties": {
833
+ "result": {
834
+ "description": "The return value of the default export of the script"
835
+ },
836
+ "logs": {
837
+ "type": "array",
838
+ "items": {
839
+ "$ref": "#/components/schemas/FreestyleJavaScriptLog"
840
+ }
841
+ }
842
+ }
843
+ }
844
+ }
845
+ }
846
+ },
847
+ "400": {
848
+ "description": "Error",
849
+ "content": {
850
+ "application/json": {
851
+ "schema": {
852
+ "type": "object",
853
+ "required": ["error"],
854
+ "properties": { "error": { "type": "string" } }
855
+ }
856
+ }
857
+ }
858
+ },
859
+ "500": {
860
+ "description": "Internal server error",
861
+ "content": {
862
+ "application/json": {
863
+ "schema": {
864
+ "type": "object",
865
+ "required": ["error"],
866
+ "properties": { "error": { "type": "string" } }
867
+ }
868
+ }
869
+ }
870
+ }
871
+ },
872
+ "x-codeSamples": [
873
+ {
874
+ "label": "JS SDK",
875
+ "lang": "javascript",
876
+ "source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.executeScript(\n `export default () => {\n let set1 = [1, 2, 3, 4, 5];\n let set2 = [4, 5, 6, 7, 8];\n\n // find the sum of every value of each set multiplied by every value of the other set\n\n let sum = 0;\n for (let i = 0; i < set1.length; i++) {\n for (let j = 0; j < set2.length; j++) {\n sum += set1[i] * set2[j];\n }\n }\n\n return sum;\n};`\n);"
877
+ },
878
+ {
879
+ "label": "Vercel AI SDK",
880
+ "lang": "javascript",
881
+ "source": "import { executeTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst codeExecutor = executeTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n codeExecutor,\n },\n maxSteps: 2,\n prompt:\n 'What is the sum of every number between 1 and 12 multiplied by itself?',\n});"
882
+ },
883
+ {
884
+ "label": "Mastra AI SDK",
885
+ "lang": "javascript",
886
+ "source": "import { executeTool } from 'freestyle-sandboxes/mastra';\n\nconst mastra = new Mastra();\n\nconst modelConfig: ModelConfig = {\n provider: 'OPEN_AI',\n name: 'gpt-4',\n};\n\nconst llm = mastra.LLM(modelConfig);\n\nconst response = await llm.generate(\n 'Calculate the sum of every number between 13 and 19 divided by the sum of every number between 8 and 13',\n {\n tools: {\n executor: executeTool({\n apiKey: process.env.FREESTYLE_API_KEY!,\n }),\n },\n }\n);\n\nconsole.log('Response Steps:', response.steps);\nconsole.log('Response:', response.text);"
887
+ },
888
+ {
889
+ "label": "LangGraph AI SDK",
890
+ "lang": "javascript",
891
+ "source": "import { createReactAgent } from '@langchain/langgraph/prebuilt';\nimport { ChatOpenAI } from '@langchain/openai';\nimport { executeTool } from 'freestyle-sandboxes/langgraph';\n\nconst model = new ChatOpenAI({ model: 'gpt-4o' });\n\nconst agent = createReactAgent({\n llm: model,\n tools: [\n executeTool({\n apiKey: process.env.FREESTYLE_API_KEY,\n nodeModules: {\n resend: '4.0.1',\n },\n envVars: {\n RESEND_API_KEY: process.env.RESEND_API_KEY,\n },\n }),\n ],\n});\n\nconst result = await agent.invoke(\n {\n messages: [\n { role: 'user', content: 'What is the factorial of 13 divided by 55^2' },\n ],\n },\n { configurable: { thread_id: 42 } }\n);\nconsole.log(result.messages.at(-1)?.content);"
892
+ },
893
+ {
894
+ "label": "Python SDK",
895
+ "lang": "python",
896
+ "source": "import freestyle\nimport os\n\nclient = freestyle.Freestyle(\n os.environ.get('FREESTYLE_API_KEY')\n)\n\ncodeExecutionResult = client.execute_script(\n \"\"\"\nimport Stripe from 'stripe';\nexport default async () => {\n\nconst stripe = new Stripe(process.env.STRIPE_API_KEY);\n\nconst paymentIntent = await stripe.paymentIntents.create({\n amount: 1099,\n currency: 'usd',\n payment_method_types: ['card'],\n});\n\nreturn paymentIntent;\n};\n \"\"\",\n freestyle.FreestyleExecuteScriptParamsConfiguration(\n env_vars={\"STRIPE_API_KEY\": os.environ.get(\"STRIPE_API_KEY\")},\n node_modules={\"stripe\": \"17.7.0\"},\n ),\n)\n\nprint('The payment intent created is:', codeExecutionResult)"
897
+ },
898
+ {
899
+ "label": "Gemini Python SDK",
900
+ "lang": "python",
901
+ "source": "import google.genai as genai\nfrom google.genai import types\n\nimport os\nimport freestyle.gemini\n\nclient = genai.Client(api_key=os.environ.get(\"GENERATIVEAI_API_KEY\"))\n\n\n# model = genai.client.com(\"gemini-2.0-flash\")\ndefinition, runner = freestyle.gemini.execute_tool(\n os.environ.get(\"FREESTYLE_API_KEY\"),\n)\nchat = client.chats.create(\n model=\"gemini-2.0-flash\",\n config=types.GenerateContentConfigDict(\n tools=[definition],\n ),\n history=[],\n)\n\nresponse = chat.send_message(\n \"What is the sum of every number from 50 to 65 divided by 17\"\n).candidates[0]\ntool_result = runner(response.content)\n\nprint(\"Answer: \", tool_result)"
902
+ },
903
+ {
904
+ "label": "OpenAI Python SDK",
905
+ "lang": "python",
906
+ "source": "import os\nimport openai\nimport freestyle.openai\n\nclient = openai.OpenAI(\n api_key=os.environ.get('OPENAI_API_KEY'),\n)\n\n\n(definition, runner) = freestyle.openai.execute_tool(\n os.environ.get('FREESTYLE_API_KEY'),\n)\n\nquery = 'What is the sum of every number from 50 to 65 divided by 17'\nmessages = [{'role': 'user', 'content': query}]\nprint('Question: ', query)\n\nres = client.chat.completions.create(\n model='gpt-4-turbo', messages=messages, tools=[definition]\n)\n\n\nresult = runner(res.choices[0].message)\n\nmessages.append(res.choices[0].message)\nif len(result) > 0:\n messages.extend(result)\n\nres = client.chat.completions.create(\n model='gpt-4-turbo',\n messages=messages,\n tools=[definition],\n)\n\nprint('Answer: ', res.choices[0].message.content)"
907
+ }
908
+ ]
909
+ }
910
+ },
911
+ "/git/v1/identity": {
912
+ "post": {
913
+ "tags": ["Git"],
914
+ "summary": "Create a Git identity",
915
+ "description": "Create a Git identity. This identity will be used to authenticate with the Git server.",
916
+ "operationId": "handle_create_identity",
917
+ "responses": {
918
+ "200": {
919
+ "description": "Identity created successfully",
920
+ "content": {
921
+ "application/json": {
922
+ "schema": { "$ref": "#/components/schemas/GitIdentity" }
923
+ }
924
+ }
925
+ },
926
+ "500": {
927
+ "description": "Internal server error",
928
+ "content": {
929
+ "application/json": {
930
+ "schema": {
931
+ "type": "object",
932
+ "required": ["message"],
933
+ "properties": { "message": { "type": "string" } }
934
+ }
935
+ }
936
+ }
937
+ }
938
+ }
939
+ }
940
+ },
941
+ "/git/v1/identity/{identity}": {
942
+ "delete": {
943
+ "tags": ["Git"],
944
+ "summary": "Delete a Git identity",
945
+ "description": "Delete a Git identity. This will revoke all permissions granted to this identity.",
946
+ "operationId": "handle_delete_identity",
947
+ "parameters": [
948
+ {
949
+ "name": "identity",
950
+ "in": "path",
951
+ "required": true,
952
+ "schema": { "type": "string" }
953
+ }
954
+ ],
955
+ "responses": {
956
+ "200": {
957
+ "description": "Identity deleted",
958
+ "content": {
959
+ "application/json": { "schema": { "type": "object" } }
960
+ }
961
+ },
962
+ "400": {
963
+ "description": "Invalid request",
964
+ "content": {
965
+ "application/json": {
966
+ "schema": {
967
+ "type": "object",
968
+ "required": ["message"],
969
+ "properties": { "message": { "type": "string" } }
970
+ }
971
+ }
972
+ }
973
+ },
974
+ "404": {
975
+ "description": "Identity not found",
976
+ "content": {
977
+ "application/json": {
978
+ "schema": {
979
+ "type": "object",
980
+ "required": ["message"],
981
+ "properties": { "message": { "type": "string" } }
982
+ }
983
+ }
984
+ }
985
+ },
986
+ "500": {
987
+ "description": "Internal server error",
988
+ "content": {
989
+ "application/json": {
990
+ "schema": {
991
+ "type": "object",
992
+ "required": ["message"],
993
+ "properties": { "message": { "type": "string" } }
994
+ }
995
+ }
996
+ }
997
+ }
998
+ }
999
+ }
1000
+ },
1001
+ "/git/v1/identity/{identity}/permissions": {
1002
+ "get": {
1003
+ "tags": ["Git"],
1004
+ "summary": "List repository permissions for an identity",
1005
+ "description": "List repository permissions for an identity. This will return a list of repositories that the identity has access to.",
1006
+ "operationId": "handle_list_permissions",
1007
+ "parameters": [
1008
+ {
1009
+ "name": "identity",
1010
+ "in": "path",
1011
+ "required": true,
1012
+ "schema": { "type": "string" }
1013
+ },
1014
+ {
1015
+ "name": "limit",
1016
+ "in": "query",
1017
+ "description": "Maximum number of repositories to return",
1018
+ "required": false,
1019
+ "schema": { "type": "integer", "format": "int64", "minimum": 0 }
1020
+ },
1021
+ {
1022
+ "name": "offset",
1023
+ "in": "query",
1024
+ "description": "Offset for the list of repositories",
1025
+ "required": false,
1026
+ "schema": { "type": "integer", "format": "int64", "minimum": 0 }
1027
+ }
1028
+ ],
1029
+ "responses": {
1030
+ "200": {
1031
+ "description": "Permission list",
1032
+ "content": {
1033
+ "application/json": {
1034
+ "schema": {
1035
+ "$ref": "#/components/schemas/ListPermissionResponseSuccess"
1036
+ }
1037
+ }
1038
+ }
1039
+ },
1040
+ "401": {
1041
+ "description": "Unauthorized",
1042
+ "content": {
1043
+ "application/json": {
1044
+ "schema": {
1045
+ "type": "object",
1046
+ "required": ["message"],
1047
+ "properties": { "message": { "type": "string" } }
1048
+ }
1049
+ }
1050
+ }
1051
+ },
1052
+ "403": {
1053
+ "description": "Forbidden",
1054
+ "content": {
1055
+ "application/json": {
1056
+ "schema": {
1057
+ "type": "object",
1058
+ "required": ["message"],
1059
+ "properties": { "message": { "type": "string" } }
1060
+ }
1061
+ }
1062
+ }
1063
+ },
1064
+ "404": {
1065
+ "description": "Not found",
1066
+ "content": {
1067
+ "application/json": {
1068
+ "schema": {
1069
+ "type": "object",
1070
+ "required": ["message"],
1071
+ "properties": { "message": { "type": "string" } }
1072
+ }
1073
+ }
1074
+ }
1075
+ },
1076
+ "500": {
1077
+ "description": "Internal server error",
1078
+ "content": {
1079
+ "application/json": {
1080
+ "schema": {
1081
+ "type": "object",
1082
+ "required": ["message"],
1083
+ "properties": { "message": { "type": "string" } }
1084
+ }
1085
+ }
1086
+ }
1087
+ }
1088
+ }
1089
+ }
1090
+ },
1091
+ "/git/v1/identity/{identity}/permissions/{repo}": {
1092
+ "get": {
1093
+ "tags": ["Git"],
1094
+ "summary": "Get the permission of an identity on a repository",
1095
+ "description": "Get the permission of an identity on a repository. This will return the access level of the identity on the repository.",
1096
+ "operationId": "handle_describe_permission",
1097
+ "parameters": [
1098
+ {
1099
+ "name": "identity",
1100
+ "in": "path",
1101
+ "required": true,
1102
+ "schema": { "type": "string" }
1103
+ },
1104
+ {
1105
+ "name": "repo",
1106
+ "in": "path",
1107
+ "required": true,
1108
+ "schema": { "type": "string" }
1109
+ }
1110
+ ],
1111
+ "responses": {
1112
+ "200": {
1113
+ "description": "Permission info",
1114
+ "content": {
1115
+ "application/json": {
1116
+ "schema": {
1117
+ "$ref": "#/components/schemas/DescribePermissionResponseSuccess"
1118
+ }
1119
+ }
1120
+ }
1121
+ },
1122
+ "401": {
1123
+ "description": "Unauthorized",
1124
+ "content": {
1125
+ "application/json": {
1126
+ "schema": {
1127
+ "type": "object",
1128
+ "required": ["message"],
1129
+ "properties": { "message": { "type": "string" } }
1130
+ }
1131
+ }
1132
+ }
1133
+ },
1134
+ "403": {
1135
+ "description": "Forbidden",
1136
+ "content": {
1137
+ "application/json": {
1138
+ "schema": {
1139
+ "type": "object",
1140
+ "required": ["message"],
1141
+ "properties": { "message": { "type": "string" } }
1142
+ }
1143
+ }
1144
+ }
1145
+ },
1146
+ "404": {
1147
+ "description": "Not found",
1148
+ "content": {
1149
+ "application/json": {
1150
+ "schema": {
1151
+ "type": "object",
1152
+ "required": ["message"],
1153
+ "properties": { "message": { "type": "string" } }
1154
+ }
1155
+ }
1156
+ }
1157
+ },
1158
+ "500": {
1159
+ "description": "Internal server error",
1160
+ "content": {
1161
+ "application/json": {
1162
+ "schema": {
1163
+ "type": "object",
1164
+ "required": ["message"],
1165
+ "properties": { "message": { "type": "string" } }
1166
+ }
1167
+ }
1168
+ }
1169
+ }
1170
+ }
1171
+ },
1172
+ "post": {
1173
+ "tags": ["Git"],
1174
+ "summary": "Grant a permission to a Git identity",
1175
+ "description": "Grant a permission to a Git identity on a repository",
1176
+ "operationId": "handle_grant_permission",
1177
+ "parameters": [
1178
+ {
1179
+ "name": "identity",
1180
+ "in": "path",
1181
+ "required": true,
1182
+ "schema": { "type": "string" }
1183
+ },
1184
+ {
1185
+ "name": "repo",
1186
+ "in": "path",
1187
+ "required": true,
1188
+ "schema": { "type": "string" }
1189
+ }
1190
+ ],
1191
+ "requestBody": {
1192
+ "content": {
1193
+ "application/json": {
1194
+ "schema": {
1195
+ "$ref": "#/components/schemas/GrantPermissionRequest"
1196
+ }
1197
+ }
1198
+ },
1199
+ "required": true
1200
+ },
1201
+ "responses": {
1202
+ "200": {
1203
+ "description": "Permission granted successfully",
1204
+ "content": {
1205
+ "application/json": { "schema": { "type": "object" } }
1206
+ }
1207
+ },
1208
+ "401": {
1209
+ "description": "Unauthorized",
1210
+ "content": {
1211
+ "application/json": {
1212
+ "schema": {
1213
+ "type": "object",
1214
+ "required": ["message"],
1215
+ "properties": { "message": { "type": "string" } }
1216
+ }
1217
+ }
1218
+ }
1219
+ },
1220
+ "403": {
1221
+ "description": "Forbidden",
1222
+ "content": {
1223
+ "application/json": {
1224
+ "schema": {
1225
+ "type": "object",
1226
+ "required": ["message"],
1227
+ "properties": { "message": { "type": "string" } }
1228
+ }
1229
+ }
1230
+ }
1231
+ },
1232
+ "404": {
1233
+ "description": "Repository not found",
1234
+ "content": {
1235
+ "application/json": {
1236
+ "schema": {
1237
+ "type": "object",
1238
+ "required": ["message"],
1239
+ "properties": { "message": { "type": "string" } }
1240
+ }
1241
+ }
1242
+ }
1243
+ },
1244
+ "500": {
1245
+ "description": "Internal server error",
1246
+ "content": {
1247
+ "application/json": {
1248
+ "schema": {
1249
+ "type": "object",
1250
+ "required": ["message"],
1251
+ "properties": { "message": { "type": "string" } }
1252
+ }
1253
+ }
1254
+ }
1255
+ }
1256
+ }
1257
+ },
1258
+ "delete": {
1259
+ "tags": ["Git"],
1260
+ "summary": "Revoke permissions from a Git identity",
1261
+ "description": "Revoke a permission to a Git identity on a repository",
1262
+ "operationId": "handle_revoke_permission",
1263
+ "parameters": [
1264
+ {
1265
+ "name": "identity",
1266
+ "in": "path",
1267
+ "required": true,
1268
+ "schema": { "type": "string" }
1269
+ },
1270
+ {
1271
+ "name": "repo",
1272
+ "in": "path",
1273
+ "required": true,
1274
+ "schema": { "type": "string" }
1275
+ }
1276
+ ],
1277
+ "responses": {
1278
+ "200": {
1279
+ "description": "Permission revoked successfully",
1280
+ "content": {
1281
+ "application/json": { "schema": { "type": "object" } }
1282
+ }
1283
+ },
1284
+ "401": {
1285
+ "description": "Unauthorized",
1286
+ "content": {
1287
+ "application/json": {
1288
+ "schema": {
1289
+ "type": "object",
1290
+ "required": ["message"],
1291
+ "properties": { "message": { "type": "string" } }
1292
+ }
1293
+ }
1294
+ }
1295
+ },
1296
+ "403": {
1297
+ "description": "Forbidden",
1298
+ "content": {
1299
+ "application/json": {
1300
+ "schema": {
1301
+ "type": "object",
1302
+ "required": ["message"],
1303
+ "properties": { "message": { "type": "string" } }
1304
+ }
1305
+ }
1306
+ }
1307
+ },
1308
+ "404": {
1309
+ "description": "Not found",
1310
+ "content": {
1311
+ "application/json": {
1312
+ "schema": {
1313
+ "type": "object",
1314
+ "required": ["message"],
1315
+ "properties": { "message": { "type": "string" } }
1316
+ }
1317
+ }
1318
+ }
1319
+ },
1320
+ "500": {
1321
+ "description": "Internal server error",
1322
+ "content": {
1323
+ "application/json": {
1324
+ "schema": {
1325
+ "type": "object",
1326
+ "required": ["message"],
1327
+ "properties": { "message": { "type": "string" } }
1328
+ }
1329
+ }
1330
+ }
1331
+ }
1332
+ }
1333
+ },
1334
+ "patch": {
1335
+ "tags": ["Git"],
1336
+ "summary": "Update a permission for a Git identity",
1337
+ "description": "Update a permission for a Git identity on a repository",
1338
+ "operationId": "handle_update_permission",
1339
+ "parameters": [
1340
+ {
1341
+ "name": "identity",
1342
+ "in": "path",
1343
+ "required": true,
1344
+ "schema": { "type": "string" }
1345
+ },
1346
+ {
1347
+ "name": "repo",
1348
+ "in": "path",
1349
+ "required": true,
1350
+ "schema": { "type": "string" }
1351
+ }
1352
+ ],
1353
+ "requestBody": {
1354
+ "content": {
1355
+ "application/json": {
1356
+ "schema": {
1357
+ "$ref": "#/components/schemas/UpdatePermissionRequest"
1358
+ }
1359
+ }
1360
+ },
1361
+ "required": true
1362
+ },
1363
+ "responses": {
1364
+ "200": {
1365
+ "description": "Permission updated successfully",
1366
+ "content": {
1367
+ "application/json": { "schema": { "type": "object" } }
1368
+ }
1369
+ },
1370
+ "401": {
1371
+ "description": "Unauthorized",
1372
+ "content": {
1373
+ "application/json": {
1374
+ "schema": {
1375
+ "type": "object",
1376
+ "required": ["message"],
1377
+ "properties": { "message": { "type": "string" } }
1378
+ }
1379
+ }
1380
+ }
1381
+ },
1382
+ "403": {
1383
+ "description": "Forbidden",
1384
+ "content": {
1385
+ "application/json": {
1386
+ "schema": {
1387
+ "type": "object",
1388
+ "required": ["message"],
1389
+ "properties": { "message": { "type": "string" } }
1390
+ }
1391
+ }
1392
+ }
1393
+ },
1394
+ "404": {
1395
+ "description": "Not found",
1396
+ "content": {
1397
+ "application/json": {
1398
+ "schema": {
1399
+ "type": "object",
1400
+ "required": ["message"],
1401
+ "properties": { "message": { "type": "string" } }
1402
+ }
1403
+ }
1404
+ }
1405
+ },
1406
+ "500": {
1407
+ "description": "Internal server error",
1408
+ "content": {
1409
+ "application/json": {
1410
+ "schema": {
1411
+ "type": "object",
1412
+ "required": ["message"],
1413
+ "properties": { "message": { "type": "string" } }
1414
+ }
1415
+ }
1416
+ }
1417
+ }
1418
+ }
1419
+ }
1420
+ },
1421
+ "/git/v1/identity/{identity}/tokens": {
1422
+ "get": {
1423
+ "tags": ["Git"],
1424
+ "summary": "List access tokens for a Git identity",
1425
+ "description": "List access tokens for a Git identity",
1426
+ "operationId": "handle_list_git_tokens",
1427
+ "parameters": [
1428
+ {
1429
+ "name": "identity",
1430
+ "in": "path",
1431
+ "required": true,
1432
+ "schema": { "type": "string" }
1433
+ }
1434
+ ],
1435
+ "responses": {
1436
+ "200": {
1437
+ "description": "Token list",
1438
+ "content": {
1439
+ "application/json": {
1440
+ "schema": {
1441
+ "$ref": "#/components/schemas/ListGitTokensResponseSuccess"
1442
+ }
1443
+ }
1444
+ }
1445
+ },
1446
+ "401": {
1447
+ "description": "Unauthorized",
1448
+ "content": {
1449
+ "application/json": {
1450
+ "schema": {
1451
+ "type": "object",
1452
+ "required": ["message"],
1453
+ "properties": { "message": { "type": "string" } }
1454
+ }
1455
+ }
1456
+ }
1457
+ },
1458
+ "403": {
1459
+ "description": "Forbidden",
1460
+ "content": {
1461
+ "application/json": {
1462
+ "schema": {
1463
+ "type": "object",
1464
+ "required": ["message"],
1465
+ "properties": { "message": { "type": "string" } }
1466
+ }
1467
+ }
1468
+ }
1469
+ },
1470
+ "404": {
1471
+ "description": "Not found",
1472
+ "content": {
1473
+ "application/json": {
1474
+ "schema": {
1475
+ "type": "object",
1476
+ "required": ["message"],
1477
+ "properties": { "message": { "type": "string" } }
1478
+ }
1479
+ }
1480
+ }
1481
+ },
1482
+ "500": {
1483
+ "description": "Internal server error",
1484
+ "content": {
1485
+ "application/json": {
1486
+ "schema": {
1487
+ "type": "object",
1488
+ "required": ["message"],
1489
+ "properties": { "message": { "type": "string" } }
1490
+ }
1491
+ }
1492
+ }
1493
+ }
1494
+ }
1495
+ },
1496
+ "post": {
1497
+ "tags": ["Git"],
1498
+ "summary": "Create an access token for a Git identity",
1499
+ "description": "Create an access token for a Git identity",
1500
+ "operationId": "handle_create_git_token",
1501
+ "parameters": [
1502
+ {
1503
+ "name": "identity",
1504
+ "in": "path",
1505
+ "required": true,
1506
+ "schema": { "type": "string" }
1507
+ }
1508
+ ],
1509
+ "responses": {
1510
+ "200": {
1511
+ "description": "Token created successfully",
1512
+ "content": {
1513
+ "application/json": {
1514
+ "schema": { "$ref": "#/components/schemas/CreatedToken" }
1515
+ }
1516
+ }
1517
+ },
1518
+ "401": {
1519
+ "description": "Unauthorized",
1520
+ "content": {
1521
+ "application/json": {
1522
+ "schema": {
1523
+ "type": "object",
1524
+ "required": ["message"],
1525
+ "properties": { "message": { "type": "string" } }
1526
+ }
1527
+ }
1528
+ }
1529
+ },
1530
+ "403": {
1531
+ "description": "Forbidden",
1532
+ "content": {
1533
+ "application/json": {
1534
+ "schema": {
1535
+ "type": "object",
1536
+ "required": ["message"],
1537
+ "properties": { "message": { "type": "string" } }
1538
+ }
1539
+ }
1540
+ }
1541
+ },
1542
+ "404": {
1543
+ "description": "Not found",
1544
+ "content": {
1545
+ "application/json": {
1546
+ "schema": {
1547
+ "type": "object",
1548
+ "required": ["message"],
1549
+ "properties": { "message": { "type": "string" } }
1550
+ }
1551
+ }
1552
+ }
1553
+ },
1554
+ "500": {
1555
+ "description": "Internal server error",
1556
+ "content": {
1557
+ "application/json": {
1558
+ "schema": {
1559
+ "type": "object",
1560
+ "required": ["message"],
1561
+ "properties": { "message": { "type": "string" } }
1562
+ }
1563
+ }
1564
+ }
1565
+ }
1566
+ }
1567
+ },
1568
+ "delete": {
1569
+ "tags": ["Git"],
1570
+ "summary": "Revoke an access token for a Git identity",
1571
+ "description": "Revoke an access token for a Git identity",
1572
+ "operationId": "handle_revoke_git_token",
1573
+ "parameters": [
1574
+ {
1575
+ "name": "identity",
1576
+ "in": "path",
1577
+ "required": true,
1578
+ "schema": { "type": "string" }
1579
+ }
1580
+ ],
1581
+ "requestBody": {
1582
+ "content": {
1583
+ "application/json": {
1584
+ "schema": { "$ref": "#/components/schemas/RevokeGitTokenRequest" }
1585
+ }
1586
+ },
1587
+ "required": true
1588
+ },
1589
+ "responses": {
1590
+ "200": {
1591
+ "description": "Token revoked",
1592
+ "content": {
1593
+ "application/json": { "schema": { "type": "object" } }
1594
+ }
1595
+ },
1596
+ "401": {
1597
+ "description": "Unauthorized",
1598
+ "content": {
1599
+ "application/json": {
1600
+ "schema": {
1601
+ "type": "object",
1602
+ "required": ["message"],
1603
+ "properties": { "message": { "type": "string" } }
1604
+ }
1605
+ }
1606
+ }
1607
+ },
1608
+ "403": {
1609
+ "description": "Forbidden",
1610
+ "content": {
1611
+ "application/json": {
1612
+ "schema": {
1613
+ "type": "object",
1614
+ "required": ["message"],
1615
+ "properties": { "message": { "type": "string" } }
1616
+ }
1617
+ }
1618
+ }
1619
+ },
1620
+ "404": {
1621
+ "description": "Not found",
1622
+ "content": {
1623
+ "application/json": {
1624
+ "schema": {
1625
+ "type": "object",
1626
+ "required": ["message"],
1627
+ "properties": { "message": { "type": "string" } }
1628
+ }
1629
+ }
1630
+ }
1631
+ },
1632
+ "500": {
1633
+ "description": "Internal server error",
1634
+ "content": {
1635
+ "application/json": {
1636
+ "schema": {
1637
+ "type": "object",
1638
+ "required": ["message"],
1639
+ "properties": { "message": { "type": "string" } }
1640
+ }
1641
+ }
1642
+ }
1643
+ }
1644
+ }
1645
+ }
1646
+ },
1647
+ "/git/v1/repo": {
1648
+ "get": {
1649
+ "tags": ["Git"],
1650
+ "summary": "List repositories",
1651
+ "description": "List repositories.",
1652
+ "operationId": "handle_list_repositories",
1653
+ "parameters": [
1654
+ {
1655
+ "name": "limit",
1656
+ "in": "query",
1657
+ "description": "Maximum number of repositories to return",
1658
+ "required": false,
1659
+ "schema": { "type": "integer", "format": "int64", "minimum": 0 }
1660
+ },
1661
+ {
1662
+ "name": "offset",
1663
+ "in": "query",
1664
+ "description": "Offset for the list of repositories",
1665
+ "required": false,
1666
+ "schema": { "type": "integer", "format": "int64", "minimum": 0 }
1667
+ }
1668
+ ],
1669
+ "responses": {
1670
+ "200": {
1671
+ "description": "List of repositories",
1672
+ "content": {
1673
+ "application/json": {
1674
+ "schema": {
1675
+ "type": "object",
1676
+ "required": ["repositories", "offset"],
1677
+ "properties": {
1678
+ "repositories": {
1679
+ "type": "array",
1680
+ "items": { "$ref": "#/components/schemas/RepositoryInfo" }
1681
+ },
1682
+ "offset": {
1683
+ "type": "integer",
1684
+ "format": "int64",
1685
+ "minimum": 0
1686
+ }
1687
+ }
1688
+ }
1689
+ }
1690
+ }
1691
+ },
1692
+ "400": {
1693
+ "description": "Invalid request",
1694
+ "content": {
1695
+ "application/json": {
1696
+ "schema": {
1697
+ "type": "object",
1698
+ "required": ["message"],
1699
+ "properties": { "message": { "type": "string" } }
1700
+ }
1701
+ }
1702
+ }
1703
+ },
1704
+ "500": {
1705
+ "description": "Internal server error",
1706
+ "content": {
1707
+ "application/json": {
1708
+ "schema": {
1709
+ "type": "object",
1710
+ "required": ["message"],
1711
+ "properties": { "message": { "type": "string" } }
1712
+ }
1713
+ }
1714
+ }
1715
+ }
1716
+ }
1717
+ },
1718
+ "post": {
1719
+ "tags": ["Git"],
1720
+ "summary": "Create a repository",
1721
+ "description": "Create a repository. Once the repository is created, it will also be created on the Git server.\nThe repository name must be unique within your account.\n\nOnce created, you can then push your code to this repository.\n\nThe repo will be available at `git.freestyle.sh/{repo-id}`\n",
1722
+ "operationId": "handle_create_repo",
1723
+ "requestBody": {
1724
+ "content": {
1725
+ "application/json": {
1726
+ "schema": {
1727
+ "$ref": "#/components/schemas/CreateRepositoryRequest"
1728
+ }
1729
+ }
1730
+ },
1731
+ "required": true
1732
+ },
1733
+ "responses": {
1734
+ "200": {
1735
+ "description": "Repository created successfully",
1736
+ "content": {
1737
+ "application/json": {
1738
+ "schema": {
1739
+ "$ref": "#/components/schemas/CreateRepositoryResponseSuccess"
1740
+ }
1741
+ }
1742
+ }
1743
+ },
1744
+ "400": {
1745
+ "description": "Invalid request",
1746
+ "content": {
1747
+ "application/json": {
1748
+ "schema": {
1749
+ "type": "object",
1750
+ "required": ["message"],
1751
+ "properties": { "message": { "type": "string" } }
1752
+ }
1753
+ }
1754
+ }
1755
+ },
1756
+ "500": {
1757
+ "description": "Internal server error",
1758
+ "content": {
1759
+ "application/json": {
1760
+ "schema": {
1761
+ "type": "object",
1762
+ "required": ["message"],
1763
+ "properties": { "message": { "type": "string" } }
1764
+ }
1765
+ }
1766
+ }
1767
+ }
1768
+ }
1769
+ }
1770
+ },
1771
+ "/git/v1/repo/{repo}": {
1772
+ "delete": {
1773
+ "tags": ["Git"],
1774
+ "summary": "Delete a repository",
1775
+ "description": "Delete a repository. This is irreversible, and will also delete the repository on the Git server.",
1776
+ "operationId": "handle_delete_repo",
1777
+ "parameters": [
1778
+ {
1779
+ "name": "repo",
1780
+ "in": "path",
1781
+ "description": "The repository id",
1782
+ "required": true,
1783
+ "schema": { "type": "string" }
1784
+ }
1785
+ ],
1786
+ "responses": {
1787
+ "200": {
1788
+ "description": "Repository deleted successfully",
1789
+ "content": {
1790
+ "application/json": { "schema": { "type": "object" } }
1791
+ }
1792
+ },
1793
+ "400": {
1794
+ "description": "Invalid request",
1795
+ "content": {
1796
+ "application/json": {
1797
+ "schema": {
1798
+ "type": "object",
1799
+ "required": ["message"],
1800
+ "properties": { "message": { "type": "string" } }
1801
+ }
1802
+ }
1803
+ }
1804
+ },
1805
+ "403": {
1806
+ "description": "User does not have permission to delete this repository",
1807
+ "content": {
1808
+ "application/json": {
1809
+ "schema": {
1810
+ "type": "object",
1811
+ "required": ["message"],
1812
+ "properties": { "message": { "type": "string" } }
1813
+ }
1814
+ }
1815
+ }
1816
+ },
1817
+ "404": {
1818
+ "description": "Repository does not exist",
1819
+ "content": {
1820
+ "application/json": { "schema": { "type": "object" } }
1821
+ }
1822
+ },
1823
+ "500": {
1824
+ "description": "Internal server error",
1825
+ "content": {
1826
+ "application/json": {
1827
+ "schema": {
1828
+ "type": "object",
1829
+ "required": ["message"],
1830
+ "properties": { "message": { "type": "string" } }
1831
+ }
1832
+ }
1833
+ }
1834
+ }
1835
+ }
1836
+ }
1837
+ },
1838
+ "/git/v1/repo/{repo}/trigger": {
1839
+ "get": {
1840
+ "tags": ["Git"],
1841
+ "summary": "List git triggers for a repository",
1842
+ "description": "List git triggers for the given repository.",
1843
+ "operationId": "handle_list_git_triggers",
1844
+ "parameters": [
1845
+ {
1846
+ "name": "repo",
1847
+ "in": "path",
1848
+ "description": "The repository id",
1849
+ "required": true,
1850
+ "schema": { "type": "string" }
1851
+ }
1852
+ ],
1853
+ "responses": {
1854
+ "200": {
1855
+ "description": "Success",
1856
+ "content": {
1857
+ "application/json": {
1858
+ "schema": {
1859
+ "type": "object",
1860
+ "required": ["triggers"],
1861
+ "properties": {
1862
+ "triggers": {
1863
+ "type": "array",
1864
+ "items": {
1865
+ "$ref": "#/components/schemas/GitRepositoryTrigger"
1866
+ }
1867
+ }
1868
+ }
1869
+ }
1870
+ }
1871
+ }
1872
+ },
1873
+ "400": {
1874
+ "description": "Invalid request",
1875
+ "content": {
1876
+ "application/json": {
1877
+ "schema": {
1878
+ "type": "object",
1879
+ "required": ["message"],
1880
+ "properties": { "message": { "type": "string" } }
1881
+ }
1882
+ }
1883
+ }
1884
+ },
1885
+ "403": {
1886
+ "description": "User does not have permission to access this repository",
1887
+ "content": {
1888
+ "application/json": {
1889
+ "schema": {
1890
+ "type": "object",
1891
+ "required": ["message"],
1892
+ "properties": { "message": { "type": "string" } }
1893
+ }
1894
+ }
1895
+ }
1896
+ },
1897
+ "404": {
1898
+ "description": "Repository does not exist",
1899
+ "content": {
1900
+ "application/json": {
1901
+ "schema": {
1902
+ "type": "object",
1903
+ "required": ["message"],
1904
+ "properties": { "message": { "type": "string" } }
1905
+ }
1906
+ }
1907
+ }
1908
+ },
1909
+ "500": {
1910
+ "description": "Internal server error",
1911
+ "content": {
1912
+ "application/json": {
1913
+ "schema": {
1914
+ "type": "object",
1915
+ "required": ["message"],
1916
+ "properties": { "message": { "type": "string" } }
1917
+ }
1918
+ }
1919
+ }
1920
+ }
1921
+ }
1922
+ },
1923
+ "post": {
1924
+ "tags": ["Git"],
1925
+ "summary": "Create a git trigger",
1926
+ "description": "Create a git trigger for the given repository.",
1927
+ "operationId": "handle_create_git_trigger",
1928
+ "parameters": [
1929
+ {
1930
+ "name": "repo",
1931
+ "in": "path",
1932
+ "description": "The repository id",
1933
+ "required": true,
1934
+ "schema": { "type": "string" }
1935
+ }
1936
+ ],
1937
+ "requestBody": {
1938
+ "content": {
1939
+ "application/json": {
1940
+ "schema": {
1941
+ "type": "object",
1942
+ "required": ["trigger", "action"],
1943
+ "properties": {
1944
+ "trigger": {
1945
+ "oneOf": [
1946
+ {
1947
+ "type": "object",
1948
+ "required": ["event"],
1949
+ "properties": {
1950
+ "branches": {
1951
+ "type": ["array", "null"],
1952
+ "items": { "type": "string" }
1953
+ },
1954
+ "globs": {
1955
+ "type": ["array", "null"],
1956
+ "items": { "type": "string" }
1957
+ },
1958
+ "event": { "type": "string", "enum": ["push"] }
1959
+ }
1960
+ }
1961
+ ]
1962
+ },
1963
+ "action": {
1964
+ "oneOf": [
1965
+ {
1966
+ "type": "object",
1967
+ "required": ["endpoint", "action"],
1968
+ "properties": {
1969
+ "endpoint": { "type": "string" },
1970
+ "action": { "type": "string", "enum": ["webhook"] }
1971
+ }
1972
+ }
1973
+ ]
1974
+ }
1975
+ }
1976
+ }
1977
+ }
1978
+ },
1979
+ "required": true
1980
+ },
1981
+ "responses": {
1982
+ "200": {
1983
+ "description": "Trigger created successfully",
1984
+ "content": {
1985
+ "application/json": {
1986
+ "schema": {
1987
+ "type": "object",
1988
+ "required": ["triggerId"],
1989
+ "properties": { "triggerId": { "type": "string" } }
1990
+ }
1991
+ }
1992
+ }
1993
+ },
1994
+ "400": {
1995
+ "description": "Invalid request",
1996
+ "content": {
1997
+ "application/json": {
1998
+ "schema": {
1999
+ "type": "object",
2000
+ "required": ["message"],
2001
+ "properties": { "message": { "type": "string" } }
2002
+ }
2003
+ }
2004
+ }
2005
+ },
2006
+ "403": {
2007
+ "description": "User does not have permission to create a trigger on this repository",
2008
+ "content": {
2009
+ "application/json": {
2010
+ "schema": {
2011
+ "type": "object",
2012
+ "required": ["message"],
2013
+ "properties": { "message": { "type": "string" } }
2014
+ }
2015
+ }
2016
+ }
2017
+ },
2018
+ "404": {
2019
+ "description": "Repository does not exist",
2020
+ "content": {
2021
+ "application/json": {
2022
+ "schema": {
2023
+ "type": "object",
2024
+ "required": ["message"],
2025
+ "properties": { "message": { "type": "string" } }
2026
+ }
2027
+ }
2028
+ }
2029
+ },
2030
+ "500": {
2031
+ "description": "Internal server error",
2032
+ "content": {
2033
+ "application/json": {
2034
+ "schema": {
2035
+ "type": "object",
2036
+ "required": ["message"],
2037
+ "properties": { "message": { "type": "string" } }
2038
+ }
2039
+ }
2040
+ }
2041
+ }
2042
+ }
2043
+ }
2044
+ },
2045
+ "/git/v1/repo/{repo}/trigger/{trigger}": {
2046
+ "delete": {
2047
+ "tags": ["Git"],
2048
+ "summary": "Delete a git trigger",
2049
+ "description": "Delete a git trigger. This is irreversible.",
2050
+ "operationId": "handle_delete_git_trigger",
2051
+ "parameters": [
2052
+ {
2053
+ "name": "repo",
2054
+ "in": "path",
2055
+ "description": "The repository id",
2056
+ "required": true,
2057
+ "schema": { "type": "string" }
2058
+ },
2059
+ {
2060
+ "name": "trigger",
2061
+ "in": "path",
2062
+ "description": "The trigger id",
2063
+ "required": true,
2064
+ "schema": { "type": "string" }
2065
+ }
2066
+ ],
2067
+ "responses": {
2068
+ "200": {
2069
+ "description": "Trigger deleted successfully",
2070
+ "content": {
2071
+ "application/json": { "schema": { "type": "object" } }
2072
+ }
2073
+ },
2074
+ "400": {
2075
+ "description": "Invalid request",
2076
+ "content": {
2077
+ "application/json": {
2078
+ "schema": {
2079
+ "type": "object",
2080
+ "required": ["message"],
2081
+ "properties": { "message": { "type": "string" } }
2082
+ }
2083
+ }
2084
+ }
2085
+ },
2086
+ "403": {
2087
+ "description": "User does not have permission to delete a trigger on this repository",
2088
+ "content": {
2089
+ "application/json": {
2090
+ "schema": {
2091
+ "type": "object",
2092
+ "required": ["message"],
2093
+ "properties": { "message": { "type": "string" } }
2094
+ }
2095
+ }
2096
+ }
2097
+ },
2098
+ "404": {
2099
+ "description": "Repository does not exist",
2100
+ "content": {
2101
+ "application/json": { "schema": { "type": "object" } }
2102
+ }
2103
+ },
2104
+ "500": {
2105
+ "description": "Internal server error",
2106
+ "content": {
2107
+ "application/json": {
2108
+ "schema": {
2109
+ "type": "object",
2110
+ "required": ["message"],
2111
+ "properties": { "message": { "type": "string" } }
2112
+ }
2113
+ }
2114
+ }
2115
+ }
2116
+ }
2117
+ }
2118
+ },
2119
+ "/observability/v1/logs": {
2120
+ "get": {
2121
+ "tags": ["Observability"],
2122
+ "summary": "Deployment Logs",
2123
+ "description": "Get the logs for a deployment",
2124
+ "operationId": "handle_get_logs",
2125
+ "parameters": [
2126
+ {
2127
+ "name": "deploymentId",
2128
+ "in": "query",
2129
+ "required": false,
2130
+ "schema": { "type": ["string", "null"] }
2131
+ },
2132
+ {
2133
+ "name": "domain",
2134
+ "in": "query",
2135
+ "required": false,
2136
+ "schema": { "type": ["string", "null"] }
2137
+ }
2138
+ ],
2139
+ "responses": {
2140
+ "200": {
2141
+ "description": "",
2142
+ "content": {
2143
+ "application/json": {
2144
+ "schema": {
2145
+ "$ref": "#/components/schemas/FreestyleGetLogsResponse"
2146
+ }
2147
+ }
2148
+ }
2149
+ }
2150
+ },
2151
+ "x-codeSamples": [
2152
+ {
2153
+ "label": "JS SDK",
2154
+ "lang": "javascript",
2155
+ "source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.getLogs({\n deploymentId: 'deployment-id',\n}).then((response) => {\n console.log(response);\n});"
2156
+ }
2157
+ ]
2158
+ }
2159
+ },
2160
+ "/web/v1/deploy": {
2161
+ "post": {
2162
+ "tags": ["Web"],
2163
+ "summary": "Deploy a Website",
2164
+ "description": "Deploy a website. Files is a map of file paths to file contents. Configuration is optional and contains additional information about the deployment.",
2165
+ "operationId": "handle_deploy_web",
2166
+ "requestBody": {
2167
+ "content": {
2168
+ "application/json": {
2169
+ "schema": {
2170
+ "$ref": "#/components/schemas/FreestyleDeployWebPayload"
2171
+ }
2172
+ }
2173
+ },
2174
+ "required": true
2175
+ },
2176
+ "responses": {
2177
+ "200": {
2178
+ "description": "successfully deployed",
2179
+ "content": {
2180
+ "application/json": {
2181
+ "schema": {
2182
+ "$ref": "#/components/schemas/FreestyleDeployWebSuccessResponse"
2183
+ }
2184
+ }
2185
+ }
2186
+ },
2187
+ "400": {
2188
+ "description": "failed to deploy",
2189
+ "content": {
2190
+ "application/json": {
2191
+ "schema": {
2192
+ "$ref": "#/components/schemas/FreestyleDeployWebErrorResponse"
2193
+ }
2194
+ }
2195
+ }
2196
+ }
2197
+ },
2198
+ "x-codeSamples": [
2199
+ {
2200
+ "label": "JS SDK",
2201
+ "lang": "javascript",
2202
+ "source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\nimport 'dotenv/config';\n\nconst api = new FreestyleSandboxes({\n apiKey: process.env.FREESTYLE_API_KEY!,\n});\n\napi\n .deployWeb({\n 'index.js': {\n content:`\n import http from 'node:http';\n console.log('starting server');\n\n const server = http.createServer(async(req, res) => {\n // wait 5 seconds before responding\n // await new Promise((resolve) => setTimeout(resolve, 5000));\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.end('Welcome to New York its been waiting for you');\n });\n\n server.listen(3000, () => {\n console.log('Server is running at http://localhost:3000');\n });`,\n }})\n .then((result) => {\n console.log('Deployed website @ ', result.deploymentId);\n });\n"
2203
+ },
2204
+ {
2205
+ "label": "Vercel AI SDK",
2206
+ "lang": "javascript",
2207
+ "source": "import { deployWebTool } from 'freestyle-sandboxes/ai';\nimport { generateText } from 'ai';\n\nconst deployer = deployWebTool({\n apiKey: 'your-api-key',\n});\n\nconst { text, steps } = await generateText({\n model: yourModel,\n tools: {\n deployer,\n },\n maxSteps: 2,\n prompt:\n 'Deploy a website to subdomain.yourdomain.com that has all the lyrics to Sandstorm by Darude on the homepage',\n});"
2208
+ }
2209
+ ]
2210
+ }
2211
+ },
2212
+ "/web/v1/deployments": {
2213
+ "get": {
2214
+ "tags": ["Web"],
2215
+ "summary": "List web deploys",
2216
+ "description": "List web deploys.",
2217
+ "operationId": "handle_list_web_deploys",
2218
+ "parameters": [
2219
+ {
2220
+ "name": "limit",
2221
+ "in": "query",
2222
+ "description": "Maximum number of repositories to return",
2223
+ "required": true,
2224
+ "schema": { "type": "integer", "format": "int64", "minimum": 0 }
2225
+ },
2226
+ {
2227
+ "name": "offset",
2228
+ "in": "query",
2229
+ "description": "Offset for the list of repositories",
2230
+ "required": true,
2231
+ "schema": { "type": "integer", "format": "int64", "minimum": 0 }
2232
+ }
2233
+ ],
2234
+ "responses": {
2235
+ "200": {
2236
+ "description": "",
2237
+ "content": {
2238
+ "application/json": {
2239
+ "schema": {
2240
+ "type": "object",
2241
+ "required": ["entries", "total", "offset"],
2242
+ "properties": {
2243
+ "entries": {
2244
+ "type": "array",
2245
+ "items": {
2246
+ "$ref": "#/components/schemas/DeploymentLogEntry"
2247
+ }
2248
+ },
2249
+ "total": {
2250
+ "type": "integer",
2251
+ "format": "int64",
2252
+ "minimum": 0
2253
+ },
2254
+ "offset": {
2255
+ "type": "integer",
2256
+ "format": "int64",
2257
+ "minimum": 0
2258
+ }
2259
+ }
2260
+ }
2261
+ }
2262
+ }
2263
+ },
2264
+ "500": {
2265
+ "description": "",
2266
+ "content": {
2267
+ "application/json": {
2268
+ "schema": {
2269
+ "type": "object",
2270
+ "required": ["message"],
2271
+ "properties": { "message": { "type": "string" } }
2272
+ }
2273
+ }
2274
+ }
2275
+ }
2276
+ },
2277
+ "x-codeSamples": [
2278
+ {
2279
+ "label": "JS SDK",
2280
+ "lang": "javascript",
2281
+ "source": "import { FreestyleSandboxes } from 'freestyle-sandboxes';\n\nconst sandboxes = new FreestyleSandboxes({\n apiKey: 'your-api-key',\n});\n\nsandboxes.listWebDeploys().then((response) => {\n console.log(response);\n});"
2282
+ }
2283
+ ]
2284
+ }
2285
+ },
2286
+ "/web/v1/deployments/deployment/{deployment_id}": {
2287
+ "get": {
2288
+ "tags": ["Web"],
2289
+ "summary": "Get information on web deploy",
2290
+ "description": "Get information about a web deploy by its ID.",
2291
+ "operationId": "handle_get_web_deploy_details",
2292
+ "parameters": [
2293
+ {
2294
+ "name": "deployment_id",
2295
+ "in": "path",
2296
+ "required": true,
2297
+ "schema": { "type": "string" }
2298
+ }
2299
+ ],
2300
+ "responses": {}
2301
+ }
2302
+ }
2303
+ },
2304
+ "components": {
2305
+ "schemas": {
2306
+ "AccessLevel": { "type": "string", "enum": ["read", "write"] },
2307
+ "AccessTokenInfo": {
2308
+ "type": "object",
2309
+ "required": ["id"],
2310
+ "properties": { "id": { "type": "string" } }
2311
+ },
2312
+ "AccessibleRepository": {
2313
+ "type": "object",
2314
+ "description": "Identical to [`RepositoryInfo`], but with the permissions field added.",
2315
+ "required": ["id", "accountId", "permissions", "visibility"],
2316
+ "properties": {
2317
+ "id": { "type": "string" },
2318
+ "name": { "type": ["string", "null"] },
2319
+ "accountId": { "type": "string" },
2320
+ "permissions": { "$ref": "#/components/schemas/AccessLevel" },
2321
+ "visibility": { "$ref": "#/components/schemas/Visibility" }
2322
+ }
2323
+ },
2324
+ "Behavior": {
2325
+ "type": "string",
2326
+ "default": "exact",
2327
+ "enum": ["regex", "exact"]
2328
+ },
2329
+ "CreateDomainMappingRequest": {
2330
+ "type": "object",
2331
+ "required": ["deploymentId"],
2332
+ "properties": { "deploymentId": { "type": "string" } }
2333
+ },
2334
+ "CreateRepositoryRequest": {
2335
+ "type": "object",
2336
+ "properties": {
2337
+ "name": {
2338
+ "type": ["string", "null"],
2339
+ "description": "This name is not visible to users, and is only accessible to you via API and in the\ndashboard. Mostly useful for observability."
2340
+ },
2341
+ "public": { "type": "boolean", "default": false }
2342
+ }
2343
+ },
2344
+ "CreateRepositoryResponseSuccess": {
2345
+ "type": "object",
2346
+ "required": ["repoId"],
2347
+ "properties": { "repoId": { "type": "string" } }
2348
+ },
2349
+ "CreatedToken": {
2350
+ "type": "object",
2351
+ "required": ["id", "token"],
2352
+ "properties": {
2353
+ "id": { "type": "string" },
2354
+ "token": { "type": "string" }
2355
+ }
2356
+ },
2357
+ "DeploymentLogEntry": {
2358
+ "type": "object",
2359
+ "required": [
2360
+ "deploymentId",
2361
+ "accountId",
2362
+ "provisionedAt",
2363
+ "timeout",
2364
+ "state",
2365
+ "domains",
2366
+ "envVars"
2367
+ ],
2368
+ "properties": {
2369
+ "deploymentId": { "type": "string", "format": "uuid" },
2370
+ "accountId": { "type": "string" },
2371
+ "provisionedAt": { "type": "string", "format": "date-time" },
2372
+ "timeout": { "type": "string" },
2373
+ "state": { "$ref": "#/components/schemas/DeploymentState" },
2374
+ "deployedAt": { "type": ["string", "null"], "format": "date-time" },
2375
+ "domains": { "type": "array", "items": { "type": "string" } },
2376
+ "envVars": {
2377
+ "type": "object",
2378
+ "additionalProperties": { "type": "string" },
2379
+ "propertyNames": { "type": "string" }
2380
+ }
2381
+ }
2382
+ },
2383
+ "DeploymentState": {
2384
+ "type": "string",
2385
+ "enum": ["provisioning", "deployed", "failed"]
2386
+ },
2387
+ "DescribePermissionResponseSuccess": {
2388
+ "type": "object",
2389
+ "required": ["identity", "repo"],
2390
+ "properties": {
2391
+ "identity": { "type": "string" },
2392
+ "repo": { "type": "string" },
2393
+ "accessLevel": {
2394
+ "oneOf": [
2395
+ { "type": "null" },
2396
+ { "$ref": "#/components/schemas/AccessLevel" }
2397
+ ]
2398
+ }
2399
+ }
2400
+ },
2401
+ "DnsRecord": {
2402
+ "type": "object",
2403
+ "required": ["kind", "name", "value", "ttl", "managed"],
2404
+ "properties": {
2405
+ "kind": { "$ref": "#/components/schemas/DnsRecordKind" },
2406
+ "name": { "type": "string" },
2407
+ "value": { "type": "string" },
2408
+ "ttl": { "type": "string" },
2409
+ "priority": {
2410
+ "type": ["integer", "null"],
2411
+ "format": "int32",
2412
+ "minimum": 0
2413
+ },
2414
+ "managed": { "type": "boolean" }
2415
+ }
2416
+ },
2417
+ "DnsRecordKind": {
2418
+ "type": "string",
2419
+ "enum": ["A", "AAAA", "CNAME", "TXT", "NS"]
2420
+ },
2421
+ "DomainVerificationRequest": {
2422
+ "type": "object",
2423
+ "required": [
2424
+ "id",
2425
+ "domain",
2426
+ "accountId",
2427
+ "verificationCode",
2428
+ "createdAt"
2429
+ ],
2430
+ "properties": {
2431
+ "id": { "type": "string", "example": "1234-5678-9012-3456" },
2432
+ "domain": { "type": "string", "example": "example.com" },
2433
+ "accountId": { "type": "string", "example": "1234-5678-9012-3456" },
2434
+ "verificationCode": {
2435
+ "type": "string",
2436
+ "example": "freestyle-verification-v1-1234-5678-9012-3456"
2437
+ },
2438
+ "createdAt": {
2439
+ "type": "integer",
2440
+ "format": "int64",
2441
+ "example": "1234567890"
2442
+ }
2443
+ }
2444
+ },
2445
+ "ExecuteLogEntry": {
2446
+ "type": "object",
2447
+ "required": [
2448
+ "deployment",
2449
+ "accountId",
2450
+ "provisionedAt",
2451
+ "state",
2452
+ "envVars"
2453
+ ],
2454
+ "properties": {
2455
+ "deployment": { "type": "string", "format": "uuid" },
2456
+ "accountId": { "type": "string" },
2457
+ "provisionedAt": { "type": "string", "format": "date-time" },
2458
+ "startedAt": { "type": ["string", "null"], "format": "date-time" },
2459
+ "duration": { "type": ["string", "null"] },
2460
+ "state": { "$ref": "#/components/schemas/ExecuteRunState" },
2461
+ "envVars": {
2462
+ "type": "object",
2463
+ "additionalProperties": { "type": "string" },
2464
+ "propertyNames": { "type": "string" }
2465
+ }
2466
+ }
2467
+ },
2468
+ "ExecuteRunInfo": {
2469
+ "type": "object",
2470
+ "required": ["code", "nodeModules"],
2471
+ "properties": {
2472
+ "code": { "type": "string" },
2473
+ "nodeModules": {
2474
+ "type": "object",
2475
+ "additionalProperties": { "type": "string" },
2476
+ "propertyNames": { "type": "string" }
2477
+ }
2478
+ }
2479
+ },
2480
+ "ExecuteRunState": {
2481
+ "type": "string",
2482
+ "enum": ["starting", "running", "complete"]
2483
+ },
2484
+ "FreestyleCloudstateDeployConfiguration": {
2485
+ "type": "object",
2486
+ "properties": {
2487
+ "domains": {
2488
+ "type": ["array", "null"],
2489
+ "items": { "type": "string" },
2490
+ "description": "ID of the project to deploy, if not provided will create a new project",
2491
+ "default": null
2492
+ },
2493
+ "envVars": {
2494
+ "type": "object",
2495
+ "description": "The environment variables that the cloudstate deploy can access",
2496
+ "default": {},
2497
+ "additionalProperties": { "type": "string" },
2498
+ "propertyNames": { "type": "string" }
2499
+ },
2500
+ "cloudstateDatabaseId": {
2501
+ "type": ["string", "null"],
2502
+ "default": null
2503
+ }
2504
+ }
2505
+ },
2506
+ "FreestyleCloudstateDeployErrorResponse": {
2507
+ "type": "object",
2508
+ "required": ["message"],
2509
+ "properties": { "message": { "type": "string" } }
2510
+ },
2511
+ "FreestyleCloudstateDeployRequest": {
2512
+ "type": "object",
2513
+ "required": ["classes"],
2514
+ "properties": {
2515
+ "classes": { "type": "string" },
2516
+ "config": {
2517
+ "$ref": "#/components/schemas/FreestyleCloudstateDeployConfiguration"
2518
+ }
2519
+ }
2520
+ },
2521
+ "FreestyleCloudstateDeploySuccessResponse": {
2522
+ "type": "object",
2523
+ "required": ["deploymentId", "cloudstateDatabaseId"],
2524
+ "properties": {
2525
+ "deploymentId": { "type": "string" },
2526
+ "cloudstateDatabaseId": { "type": "string" }
2527
+ }
2528
+ },
2529
+ "FreestyleDeleteDomainVerificationRequest": {
2530
+ "type": "object",
2531
+ "required": ["domain", "verificationCode"],
2532
+ "properties": {
2533
+ "domain": {
2534
+ "type": "string",
2535
+ "description": "The domain to create a verification code for",
2536
+ "example": "example.com"
2537
+ },
2538
+ "verificationCode": {
2539
+ "type": "string",
2540
+ "description": "The verification code"
2541
+ }
2542
+ }
2543
+ },
2544
+ "FreestyleDeployWebConfiguration": {
2545
+ "type": "object",
2546
+ "properties": {
2547
+ "entrypoint": {
2548
+ "type": ["string", "null"],
2549
+ "description": "The entrypoint file for the website",
2550
+ "default": "index.js"
2551
+ },
2552
+ "domains": {
2553
+ "type": ["array", "null"],
2554
+ "items": { "type": "string" },
2555
+ "description": "The custom domains for the website, eg. [\\\"subdomain.yourwebsite.com\\\"]. You may include a single *.style.dev domain here.",
2556
+ "example": ["subdomain.yourdomain.com"],
2557
+ "default": null
2558
+ },
2559
+ "projectId": {
2560
+ "type": ["string", "null"],
2561
+ "description": "Project ID was our original way of tracking deployments together, it is now deprecated and will be removed in the future. Please use the domains field to specify the domains for your project.",
2562
+ "default": null,
2563
+ "deprecated": true
2564
+ },
2565
+ "nodeModules": {
2566
+ "type": ["object", "null"],
2567
+ "description": "Node Modules to install for the website, a map of package names to versions, e.g. { \\\"express\\\": \\\"4.17.1\\\" }. If this and a package-lock.json are provided, the package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock is also provided, the versions here will override the versions in those lock files.",
2568
+ "default": null,
2569
+ "additionalProperties": { "type": "string" },
2570
+ "propertyNames": { "type": "string" },
2571
+ "example": { "resend": "4.0.1" }
2572
+ },
2573
+ "envVars": {
2574
+ "type": ["object", "null"],
2575
+ "description": "The environment variables that the website can access\ne.g. { \\\"RESEND_API_KEY\\\": \\\"re_123456789\\\" }",
2576
+ "default": null,
2577
+ "additionalProperties": { "type": "string" },
2578
+ "propertyNames": { "type": "string" },
2579
+ "example": { "RESEND_API_KEY": "re_123456789" }
2580
+ },
2581
+ "serverStartCheck": { "type": "boolean", "default": false },
2582
+ "networkPermissions": {
2583
+ "type": ["array", "null"],
2584
+ "items": {
2585
+ "$ref": "#/components/schemas/FreestyleNetworkPermission"
2586
+ },
2587
+ "default": null
2588
+ }
2589
+ }
2590
+ },
2591
+ "FreestyleDeployWebErrorResponse": {
2592
+ "type": "object",
2593
+ "required": ["message"],
2594
+ "properties": { "message": { "type": "string" } }
2595
+ },
2596
+ "FreestyleDeployWebPayload": {
2597
+ "type": "object",
2598
+ "required": ["files"],
2599
+ "properties": {
2600
+ "files": {
2601
+ "type": "object",
2602
+ "description": "The files to deploy, a map of file paths to file contents, e.g. { \\\"index.js\\\": {\\\"content\\\": \\\"your main\\\", \\\"encoding\\\": \\\"utf-8\\\"}, \\\"file2.js\\\": {\\\"content\\\": \\\"your helper\\\" } }\n\n**Do not include node modules in this bundle, they will not work**. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install.",
2603
+ "additionalProperties": {
2604
+ "$ref": "#/components/schemas/FreestyleFile"
2605
+ },
2606
+ "propertyNames": { "type": "string" },
2607
+ "example": {
2608
+ "index.js": {
2609
+ "content": "import http from 'node:http';\\n// import { resolver } from './file2.js';\\n\\nconsole.log('starting server');\\n\\nconst server = http.createServer(async(req, res) => {\\n // wait 5 seconds before responding\\n // await new Promise((resolve) => setTimeout(resolve, 5000));\\n res.writeHead(200, { 'Content-Type': 'text/plain' });\\n res.end('Welcome to New York its been waiting for you');\\n});\\n\\nserver.listen(3000, () => {\\n console.log('Server is running at http://localhost:3000');\\n});"
2610
+ }
2611
+ }
2612
+ },
2613
+ "config": {
2614
+ "$ref": "#/components/schemas/FreestyleDeployWebConfiguration"
2615
+ }
2616
+ }
2617
+ },
2618
+ "FreestyleDeployWebSuccessResponse": {
2619
+ "type": "object",
2620
+ "required": ["deploymentId"],
2621
+ "properties": {
2622
+ "deploymentId": { "type": "string" },
2623
+ "domains": {
2624
+ "type": ["array", "null"],
2625
+ "items": { "type": "string" }
2626
+ },
2627
+ "projectId": { "type": ["string", "null"], "deprecated": true }
2628
+ }
2629
+ },
2630
+ "FreestyleDomainVerificationRequest": {
2631
+ "type": "object",
2632
+ "required": ["domain"],
2633
+ "properties": {
2634
+ "domain": {
2635
+ "type": "string",
2636
+ "description": "The domain to create a verification code for",
2637
+ "example": "example.com"
2638
+ }
2639
+ }
2640
+ },
2641
+ "FreestyleExecuteScriptParams": {
2642
+ "type": "object",
2643
+ "required": ["script"],
2644
+ "properties": {
2645
+ "script": {
2646
+ "type": "string",
2647
+ "description": "The JavaScript or TypeScript script to execute",
2648
+ "example": "export default () => {\n // get the value of the factorials of the numbers from 1 to 10 combined\n const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n\n function factorial(n) {\n if (n === 0) {\n return 1;\n }\n return n * factorial(n - 1);\n }\n\n const b = a.map(factorial);\n\n return b.reduce((a, b) => a + b);\n};\n"
2649
+ },
2650
+ "config": {
2651
+ "$ref": "#/components/schemas/FreestyleExecuteScriptParamsConfiguration"
2652
+ }
2653
+ }
2654
+ },
2655
+ "FreestyleExecuteScriptParamsConfiguration": {
2656
+ "type": "object",
2657
+ "properties": {
2658
+ "envVars": {
2659
+ "type": "object",
2660
+ "description": "The environment variables to set for the script",
2661
+ "default": {},
2662
+ "additionalProperties": { "type": "string" },
2663
+ "propertyNames": { "type": "string" },
2664
+ "example": { "RESEND_API_KEY": "re_123456789" }
2665
+ },
2666
+ "nodeModules": {
2667
+ "type": "object",
2668
+ "description": "The node modules to install for the script",
2669
+ "default": {},
2670
+ "additionalProperties": { "type": "string" },
2671
+ "propertyNames": { "type": "string" },
2672
+ "example": { "resend": "4.0.1" }
2673
+ },
2674
+ "tags": {
2675
+ "type": "array",
2676
+ "items": { "type": "string" },
2677
+ "description": "Tags for you to organize your scripts, useful for tracking what you're running",
2678
+ "example": ["email"],
2679
+ "default": []
2680
+ },
2681
+ "timeout": {
2682
+ "type": ["string", "null"],
2683
+ "description": "The script timeout",
2684
+ "default": null
2685
+ },
2686
+ "peerDependencyResolution": {
2687
+ "type": "boolean",
2688
+ "description": "If false, we'll not resolve peer dependencies for the packages given, this can speed up execute performance, but will break packages with peers unless the peers are manually specified.",
2689
+ "default": true
2690
+ },
2691
+ "networkPermissions": {
2692
+ "type": ["array", "null"],
2693
+ "items": {
2694
+ "$ref": "#/components/schemas/FreestyleNetworkPermission"
2695
+ },
2696
+ "default": null
2697
+ },
2698
+ "customHeaders": {
2699
+ "type": "object",
2700
+ "description": "These headers will be added to every fetch request made through the script",
2701
+ "default": {},
2702
+ "additionalProperties": { "type": "string" },
2703
+ "propertyNames": { "type": "string" }
2704
+ }
2705
+ }
2706
+ },
2707
+ "FreestyleExecuteScriptResultSuccess": {
2708
+ "type": "object",
2709
+ "required": ["result", "logs"],
2710
+ "properties": {
2711
+ "result": {
2712
+ "description": "The return value of the default export of the script"
2713
+ },
2714
+ "logs": {
2715
+ "type": "array",
2716
+ "items": { "$ref": "#/components/schemas/FreestyleJavaScriptLog" }
2717
+ }
2718
+ }
2719
+ },
2720
+ "FreestyleFile": {
2721
+ "type": "object",
2722
+ "required": ["content"],
2723
+ "properties": {
2724
+ "content": {
2725
+ "type": "string",
2726
+ "description": "The content of the file"
2727
+ },
2728
+ "encoding": {
2729
+ "type": "string",
2730
+ "description": "The encoding of the file. Either **utf-8** or **base64**"
2731
+ }
2732
+ }
2733
+ },
2734
+ "FreestyleGetLogsResponse": {
2735
+ "type": "object",
2736
+ "required": ["logs"],
2737
+ "properties": {
2738
+ "logs": {
2739
+ "type": "array",
2740
+ "items": {
2741
+ "$ref": "#/components/schemas/FreestyleLogResponseObject"
2742
+ }
2743
+ }
2744
+ }
2745
+ },
2746
+ "FreestyleJavaScriptLog": {
2747
+ "type": "object",
2748
+ "required": ["message", "type"],
2749
+ "properties": {
2750
+ "message": {
2751
+ "type": "string",
2752
+ "description": "The log message",
2753
+ "example": "I'm a log!"
2754
+ },
2755
+ "type": {
2756
+ "type": "string",
2757
+ "description": "The log level",
2758
+ "example": "log"
2759
+ }
2760
+ }
2761
+ },
2762
+ "FreestyleLogResponseObject": {
2763
+ "type": "object",
2764
+ "required": ["message", "timestamp"],
2765
+ "properties": {
2766
+ "message": { "type": "string" },
2767
+ "timestamp": { "type": "string" }
2768
+ }
2769
+ },
2770
+ "FreestyleNetworkPermission": {
2771
+ "oneOf": [
2772
+ {
2773
+ "allOf": [
2774
+ { "$ref": "#/components/schemas/NetworkPermissionData" },
2775
+ {
2776
+ "type": "object",
2777
+ "required": ["action"],
2778
+ "properties": {
2779
+ "action": { "type": "string", "enum": ["allow"] }
2780
+ }
2781
+ }
2782
+ ]
2783
+ },
2784
+ {
2785
+ "allOf": [
2786
+ { "$ref": "#/components/schemas/NetworkPermissionData" },
2787
+ {
2788
+ "type": "object",
2789
+ "required": ["action"],
2790
+ "properties": {
2791
+ "action": { "type": "string", "enum": ["deny"] }
2792
+ }
2793
+ }
2794
+ ]
2795
+ }
2796
+ ]
2797
+ },
2798
+ "FreestyleVerifyDomainRequest": {
2799
+ "oneOf": [
2800
+ {
2801
+ "type": "object",
2802
+ "required": ["domain"],
2803
+ "properties": {
2804
+ "domain": { "type": "string", "example": "example.com" }
2805
+ }
2806
+ },
2807
+ {
2808
+ "type": "object",
2809
+ "required": ["id"],
2810
+ "properties": {
2811
+ "id": { "type": "string", "example": "1234-5678-9012-3456" }
2812
+ }
2813
+ }
2814
+ ],
2815
+ "description": "Verify a domain verification request, can either be done for a domain, or for a specific request"
2816
+ },
2817
+ "GitIdentity": {
2818
+ "type": "object",
2819
+ "required": ["id"],
2820
+ "properties": { "id": { "type": "string" } }
2821
+ },
2822
+ "GitRepositoryTrigger": {
2823
+ "type": "object",
2824
+ "required": [
2825
+ "repositoryId",
2826
+ "trigger",
2827
+ "action",
2828
+ "managed",
2829
+ "id",
2830
+ "createdAt"
2831
+ ],
2832
+ "properties": {
2833
+ "repositoryId": { "type": "string" },
2834
+ "trigger": {
2835
+ "oneOf": [
2836
+ {
2837
+ "type": "object",
2838
+ "required": ["event"],
2839
+ "properties": {
2840
+ "branches": {
2841
+ "type": ["array", "null"],
2842
+ "items": { "type": "string" }
2843
+ },
2844
+ "globs": {
2845
+ "type": ["array", "null"],
2846
+ "items": { "type": "string" }
2847
+ },
2848
+ "event": { "type": "string", "enum": ["push"] }
2849
+ }
2850
+ }
2851
+ ]
2852
+ },
2853
+ "action": {
2854
+ "oneOf": [
2855
+ {
2856
+ "type": "object",
2857
+ "required": ["endpoint", "action"],
2858
+ "properties": {
2859
+ "endpoint": { "type": "string" },
2860
+ "action": { "type": "string", "enum": ["webhook"] }
2861
+ }
2862
+ }
2863
+ ]
2864
+ },
2865
+ "managed": { "type": "boolean" },
2866
+ "id": { "type": "string" },
2867
+ "createdAt": { "type": "integer", "format": "int64" }
2868
+ }
2869
+ },
2870
+ "GitTrigger": {
2871
+ "oneOf": [
2872
+ {
2873
+ "type": "object",
2874
+ "required": ["event"],
2875
+ "properties": {
2876
+ "branches": {
2877
+ "type": ["array", "null"],
2878
+ "items": { "type": "string" }
2879
+ },
2880
+ "globs": {
2881
+ "type": ["array", "null"],
2882
+ "items": { "type": "string" }
2883
+ },
2884
+ "event": { "type": "string", "enum": ["push"] }
2885
+ }
2886
+ }
2887
+ ]
2888
+ },
2889
+ "GitTriggerAction": {
2890
+ "oneOf": [
2891
+ {
2892
+ "type": "object",
2893
+ "required": ["endpoint", "action"],
2894
+ "properties": {
2895
+ "endpoint": { "type": "string" },
2896
+ "action": { "type": "string", "enum": ["webhook"] }
2897
+ }
2898
+ }
2899
+ ]
2900
+ },
2901
+ "GrantPermissionRequest": {
2902
+ "type": "object",
2903
+ "required": ["permission"],
2904
+ "properties": {
2905
+ "permission": { "$ref": "#/components/schemas/AccessLevel" }
2906
+ }
2907
+ },
2908
+ "ListGitTokensResponseSuccess": {
2909
+ "type": "object",
2910
+ "required": ["tokens"],
2911
+ "properties": {
2912
+ "tokens": {
2913
+ "type": "array",
2914
+ "items": { "$ref": "#/components/schemas/AccessTokenInfo" }
2915
+ }
2916
+ }
2917
+ },
2918
+ "ListPermissionResponseSuccess": {
2919
+ "type": "object",
2920
+ "required": ["repositories"],
2921
+ "properties": {
2922
+ "repositories": {
2923
+ "type": "array",
2924
+ "items": { "$ref": "#/components/schemas/AccessibleRepository" }
2925
+ }
2926
+ }
2927
+ },
2928
+ "ListRecordsResponse": {
2929
+ "type": "object",
2930
+ "required": ["records"],
2931
+ "properties": {
2932
+ "records": {
2933
+ "type": "array",
2934
+ "items": { "$ref": "#/components/schemas/DnsRecord" }
2935
+ }
2936
+ }
2937
+ },
2938
+ "NetworkPermissionData": {
2939
+ "type": "object",
2940
+ "required": ["query"],
2941
+ "properties": {
2942
+ "query": { "type": "string" },
2943
+ "behavior": { "$ref": "#/components/schemas/Behavior" }
2944
+ }
2945
+ },
2946
+ "RepositoryInfo": {
2947
+ "type": "object",
2948
+ "required": ["id", "accountId", "visibility"],
2949
+ "properties": {
2950
+ "id": { "type": "string" },
2951
+ "name": { "type": ["string", "null"], "examples": ["my-repo"] },
2952
+ "accountId": { "type": "string" },
2953
+ "visibility": { "$ref": "#/components/schemas/Visibility" }
2954
+ }
2955
+ },
2956
+ "RevokeGitTokenRequest": {
2957
+ "type": "object",
2958
+ "required": ["tokenId"],
2959
+ "properties": { "tokenId": { "type": "string" } }
2960
+ },
2961
+ "UpdatePermissionRequest": {
2962
+ "type": "object",
2963
+ "required": ["permission"],
2964
+ "properties": {
2965
+ "permission": { "$ref": "#/components/schemas/AccessLevel" }
2966
+ }
2967
+ },
2968
+ "Visibility": { "type": "string", "enum": ["public", "private"] }
2969
+ },
2970
+ "responses": {
2971
+ "FreestyleExecuteScriptResultSuccess": {
2972
+ "description": "",
2973
+ "content": {
2974
+ "application/json": {
2975
+ "schema": {
2976
+ "type": "object",
2977
+ "required": ["result", "logs"],
2978
+ "properties": {
2979
+ "result": {
2980
+ "description": "The return value of the default export of the script"
2981
+ },
2982
+ "logs": {
2983
+ "type": "array",
2984
+ "items": {
2985
+ "$ref": "#/components/schemas/FreestyleJavaScriptLog"
2986
+ }
2987
+ }
2988
+ }
2989
+ }
2990
+ }
2991
+ }
2992
+ }
2993
+ },
2994
+ "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer" } }
2995
+ },
2996
+ "tags": [
2997
+ {
2998
+ "name": "Web",
2999
+ "description": "APIs for deploying websites. We handle node modules caching, scaling, certificates and the whole end to end process. Send the code using the [deploy](#tag/web/POST/web/v1/deploy) endpoint, and you'll get a full hosted website back. Works with any TypeScript or JavaScript codebase."
3000
+ },
3001
+ {
3002
+ "name": "Execute",
3003
+ "description": "APIs for running code. Send the code using the [execute](#tag/execute/POST/execute/v1/execute) endpoint, and you'll get the output back. Works with any TypeScript or JavaScript code + handles any node modules and environment variables you want."
3004
+ },
3005
+ {
3006
+ "name": "Cloudstate",
3007
+ "description": "APIs for running cloud functions with persistent state. [Cloudstate](https://github.com/freestyle-sh/cloudstate/) is an opensource, durable JavaScript runtime maintained by the Freestyle Team."
3008
+ },
3009
+ {
3010
+ "name": "Domains",
3011
+ "description": "APIs for managing domains. This is only relevant when you want to start to deploy to custom domains. \nPlease read [this guide](https://github.com/freestyle-sh/sandbox_sdks/blob/main/docs/custom_domains.md) to understand how deployments work with custom domains."
3012
+ },
3013
+ { "name": "Git", "description": "APIs for managing git repositories." },
3014
+ { "name": "DNS", "description": "APIs for managing DNS records. WIP." }
3015
+ ]
3016
+ }