https://orbiter.host/orbiter.pngOfficial documentation for Orbiter Skip to content

Upload Key

POST
/keys/upload_key

All sites on Orbiter are hosted on IPFS through Pinata, so all site deployments require a CID as a reference to the content. Orbiter has created an API route you can use to generate a temporary one-time use API key to upload a website folder.

import { PinataSDK } from "pinata-web3"

const pinata = new PinataSDK({
  pinataJwt: "",
  pinataGateway: ""
})

const keyReq = await fetch("https://api.orbiter.host/keys/upload_key", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Orbiter-API-Key": "<YOUR-API-KEY>"
  },
  body: null
})

const keyRes = await keyReq.json()
const files: File[] = [] // Get a folder of files either locally or through a front end
const upload = await pinata.upload.fileArray(files).key(keyRes.data)

const deploySite = await fetch("https://api.orbiter.host/sites", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Orbiter-API-Key": "<YOUR-API-KEY>"
  },
  body: JSON.stringify({
    cid: upload.IpfsHash,
    subdomain: "my-site"
  })
})

Authorizations

Request Body

object
Examples
{}

Responses

200

Upload Key

object
data
string
REDACTED
Examples
{
"data": "REDACTED"
}