curl --request POST \
--url https://api.buildwithchirp.com/v1/functions/{slug}/deployments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entryPointUrl": "main.ts",
"assets": {
"main.ts": {
"kind": "file",
"content": "Deno.serve((req: Request) => new Response(\"Hello World\"));",
"encoding": "utf-8"
},
"symlink.ts": {
"kind": "symlink",
"target": "main.ts"
}
},
"importMapUrl": "import_map.json",
"lockFileUrl": "deno.lock"
}
'import requests
url = "https://api.buildwithchirp.com/v1/functions/{slug}/deployments"
payload = {
"entryPointUrl": "main.ts",
"assets": {
"main.ts": {
"kind": "file",
"content": "Deno.serve((req: Request) => new Response(\"Hello World\"));",
"encoding": "utf-8"
},
"symlink.ts": {
"kind": "symlink",
"target": "main.ts"
}
},
"importMapUrl": "import_map.json",
"lockFileUrl": "deno.lock"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entryPointUrl: 'main.ts',
assets: {
'main.ts': {
kind: 'file',
content: 'Deno.serve((req: Request) => new Response("Hello World"));',
encoding: 'utf-8'
},
'symlink.ts': {kind: 'symlink', target: 'main.ts'}
},
importMapUrl: 'import_map.json',
lockFileUrl: 'deno.lock'
})
};
fetch('https://api.buildwithchirp.com/v1/functions/{slug}/deployments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.buildwithchirp.com/v1/functions/{slug}/deployments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'entryPointUrl' => 'main.ts',
'assets' => [
'main.ts' => [
'kind' => 'file',
'content' => 'Deno.serve((req: Request) => new Response("Hello World"));',
'encoding' => 'utf-8'
],
'symlink.ts' => [
'kind' => 'symlink',
'target' => 'main.ts'
]
],
'importMapUrl' => 'import_map.json',
'lockFileUrl' => 'deno.lock'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.buildwithchirp.com/v1/functions/{slug}/deployments"
payload := strings.NewReader("{\n \"entryPointUrl\": \"main.ts\",\n \"assets\": {\n \"main.ts\": {\n \"kind\": \"file\",\n \"content\": \"Deno.serve((req: Request) => new Response(\\\"Hello World\\\"));\",\n \"encoding\": \"utf-8\"\n },\n \"symlink.ts\": {\n \"kind\": \"symlink\",\n \"target\": \"main.ts\"\n }\n },\n \"importMapUrl\": \"import_map.json\",\n \"lockFileUrl\": \"deno.lock\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.buildwithchirp.com/v1/functions/{slug}/deployments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entryPointUrl\": \"main.ts\",\n \"assets\": {\n \"main.ts\": {\n \"kind\": \"file\",\n \"content\": \"Deno.serve((req: Request) => new Response(\\\"Hello World\\\"));\",\n \"encoding\": \"utf-8\"\n },\n \"symlink.ts\": {\n \"kind\": \"symlink\",\n \"target\": \"main.ts\"\n }\n },\n \"importMapUrl\": \"import_map.json\",\n \"lockFileUrl\": \"deno.lock\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buildwithchirp.com/v1/functions/{slug}/deployments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entryPointUrl\": \"main.ts\",\n \"assets\": {\n \"main.ts\": {\n \"kind\": \"file\",\n \"content\": \"Deno.serve((req: Request) => new Response(\\\"Hello World\\\"));\",\n \"encoding\": \"utf-8\"\n },\n \"symlink.ts\": {\n \"kind\": \"symlink\",\n \"target\": \"main.ts\"\n }\n },\n \"importMapUrl\": \"import_map.json\",\n \"lockFileUrl\": \"deno.lock\"\n}"
response = http.request(request)
puts response.read_body{
"id": "abcde12vwxyz",
"projectId": "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11",
"description": "My deployment",
"status": "pending",
"createdAt": "2021-08-01T00:00:00Z",
"updatedAt": "2021-08-01T00:00:00Z"
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}Create function deployment
Create a new deployment for the function
curl --request POST \
--url https://api.buildwithchirp.com/v1/functions/{slug}/deployments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entryPointUrl": "main.ts",
"assets": {
"main.ts": {
"kind": "file",
"content": "Deno.serve((req: Request) => new Response(\"Hello World\"));",
"encoding": "utf-8"
},
"symlink.ts": {
"kind": "symlink",
"target": "main.ts"
}
},
"importMapUrl": "import_map.json",
"lockFileUrl": "deno.lock"
}
'import requests
url = "https://api.buildwithchirp.com/v1/functions/{slug}/deployments"
payload = {
"entryPointUrl": "main.ts",
"assets": {
"main.ts": {
"kind": "file",
"content": "Deno.serve((req: Request) => new Response(\"Hello World\"));",
"encoding": "utf-8"
},
"symlink.ts": {
"kind": "symlink",
"target": "main.ts"
}
},
"importMapUrl": "import_map.json",
"lockFileUrl": "deno.lock"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entryPointUrl: 'main.ts',
assets: {
'main.ts': {
kind: 'file',
content: 'Deno.serve((req: Request) => new Response("Hello World"));',
encoding: 'utf-8'
},
'symlink.ts': {kind: 'symlink', target: 'main.ts'}
},
importMapUrl: 'import_map.json',
lockFileUrl: 'deno.lock'
})
};
fetch('https://api.buildwithchirp.com/v1/functions/{slug}/deployments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.buildwithchirp.com/v1/functions/{slug}/deployments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'entryPointUrl' => 'main.ts',
'assets' => [
'main.ts' => [
'kind' => 'file',
'content' => 'Deno.serve((req: Request) => new Response("Hello World"));',
'encoding' => 'utf-8'
],
'symlink.ts' => [
'kind' => 'symlink',
'target' => 'main.ts'
]
],
'importMapUrl' => 'import_map.json',
'lockFileUrl' => 'deno.lock'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.buildwithchirp.com/v1/functions/{slug}/deployments"
payload := strings.NewReader("{\n \"entryPointUrl\": \"main.ts\",\n \"assets\": {\n \"main.ts\": {\n \"kind\": \"file\",\n \"content\": \"Deno.serve((req: Request) => new Response(\\\"Hello World\\\"));\",\n \"encoding\": \"utf-8\"\n },\n \"symlink.ts\": {\n \"kind\": \"symlink\",\n \"target\": \"main.ts\"\n }\n },\n \"importMapUrl\": \"import_map.json\",\n \"lockFileUrl\": \"deno.lock\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.buildwithchirp.com/v1/functions/{slug}/deployments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entryPointUrl\": \"main.ts\",\n \"assets\": {\n \"main.ts\": {\n \"kind\": \"file\",\n \"content\": \"Deno.serve((req: Request) => new Response(\\\"Hello World\\\"));\",\n \"encoding\": \"utf-8\"\n },\n \"symlink.ts\": {\n \"kind\": \"symlink\",\n \"target\": \"main.ts\"\n }\n },\n \"importMapUrl\": \"import_map.json\",\n \"lockFileUrl\": \"deno.lock\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buildwithchirp.com/v1/functions/{slug}/deployments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entryPointUrl\": \"main.ts\",\n \"assets\": {\n \"main.ts\": {\n \"kind\": \"file\",\n \"content\": \"Deno.serve((req: Request) => new Response(\\\"Hello World\\\"));\",\n \"encoding\": \"utf-8\"\n },\n \"symlink.ts\": {\n \"kind\": \"symlink\",\n \"target\": \"main.ts\"\n }\n },\n \"importMapUrl\": \"import_map.json\",\n \"lockFileUrl\": \"deno.lock\"\n}"
response = http.request(request)
puts response.read_body{
"id": "abcde12vwxyz",
"projectId": "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11",
"description": "My deployment",
"status": "pending",
"createdAt": "2021-08-01T00:00:00Z",
"updatedAt": "2021-08-01T00:00:00Z"
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}{
"error": {
"type": "invalid_request_error",
"message": "The phone number \"+1abc\" is not in E.164 format.",
"code": "invalid_phone_number",
"doc_url": "https://docs.buildwithchirp.com/api_reference/error-codes#invalid_phone_number",
"param": "from",
"provider": {
"source": "meta",
"code": 123,
"message": "<string>",
"fbtrace_id": "<string>",
"health_status": {
"entities": [
{
"id": "<string>",
"can_send_message": "AVAILABLE",
"errors": [
{
"error_code": 123,
"error_description": "<string>",
"possible_solution": "<string>"
}
]
}
]
}
},
"additional_info": [
"<string>"
]
}
}Authorizations
App API key (format: sk_live_app_* or sk_test_app_*) for app-level operations
Path Parameters
Function slug identifier
1"my-function"
Body
URL of the entry point of the application. This is the file that will be executed when the deployment is invoked.
"main.ts"
A map whose key represents a file path, and the value is an asset that composes the deployment.
Show child attributes
Show child attributes
{
"main.ts": {
"kind": "file",
"content": "Deno.serve((req: Request) => new Response(\"Hello World\"));",
"encoding": "utf-8"
},
"symlink.ts": { "kind": "symlink", "target": "main.ts" }
}
URL of the import map file. If null, auto-discovery will be performed. If empty string, no import map will be used.
"import_map.json"
URL of the lock file. If null, auto-discovery will be performed. If empty string, no lock file will be used.
"deno.lock"
Response
Create a new deployment for the function
Deployment ID (not UUID v4)
"abcde12vwxyz"
Project UUID
"a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11"
The description of this deployment
"My deployment"
The status of the deployment
failed, pending, success "pending"
When the deployment was created
"2021-08-01T00:00:00Z"
When the deployment was last updated
"2021-08-01T00:00:00Z"