HCC Docs

Hosting

Upload hosted code

POST /v1/hosting/uploads flows:write

What hcc deploy sends for definitions with hosting: 'hcc'. We put the bundle on our hosting with its secrets, check that it serves what manifest says, and answer with an id. Nothing runs it until the deploy's PUT /v1/flows, /v1/campaigns or /v1/text-flows carries that id as uploadId. Live hosted code runs on a live plan in good standing: without one this is 402, with the reason billing stops new calls for.

Body

  • bundle string required

    The hosted bundle: one ES module, everything inlined

  • bundleHash string required

    The bundle's SHA-256, hex

  • manifest HostedManifest required

    The hosted definitions it serves, by version

    Fields
    • flows object[] required
      Fields
      • name string required
      • version string required
    • campaigns object[] required
      Fields
      • name string required
      • version string required
    • textFlows object[] required
      Fields
      • name string required
      • version string required
  • alsoTest boolean

    Live keys only: also upload the same bundle to test, with test's secrets, for a deploy whose PUTs send alsoTest. They take its test.id as testUploadId. Default false.

Responses

  • 200

    Uploaded and loaded, ready to activate

    Fields
    • data HostedUpload required
      Fields
      • id string required

        Pass it as uploadId to the deploy

      • status "ready" required
      • bundleHash string required
      • environment "live" | "test" required
      • test object

        With alsoTest: the same bundle on test. Pass its id as testUploadId.

  • 400

    Invalid request

  • 401

    Missing or invalid API key

  • 404

    Not found

  • 429

    rate_limited, or another limit named by error.code

Get the hosted code running

GET /v1/hosting/active flows:read

What hcc deploy --check compares a fresh build's hash with.

Responses

  • 200

    The active hosted script, or null

    Fields
    • data HostedScript required

      The hosted code running, or null when none is.

      Fields
      • bundleHash string required
      • bundleBytes integer required
      • activatedAt string | null required
      • manifest HostedManifest required

        The hosted definitions it serves, by version

  • 400

    Invalid request

  • 401

    Missing or invalid API key

  • 404

    Not found

  • 429

    rate_limited, or another limit named by error.code

List hosted secrets

GET /v1/hosting/secrets flows:read

The key's environment's secret names and when each was set. Never values.

Responses

  • 200

    The secrets

    Fields
    • data HostedSecret[] required
      Fields
      • name string required
      • environment "live" | "test" required
      • setAt string required
  • 400

    Invalid request

  • 401

    Missing or invalid API key

  • 404

    Not found

  • 429

    rate_limited, or another limit named by error.code

Set a hosted secret

PUT /v1/hosting/secrets/{name} secrets:write

Hosted code reads it as ctx.env.NAME, or env('NAME') in a definition. It's write-only: nothing returns its value. Setting it replaces the old value, and running hosted code gets it without a deploy.

Path

  • name string required

Body

  • value string required

Responses

  • 200

    Set

    Fields
    • data HostedSecretWrite required
      Fields
      • applied boolean required

        Whether the running hosted code has it now. False: none is running, or it couldn't be reached; the next deploy brings it.

  • 400

    Invalid request

  • 401

    Missing or invalid API key

  • 404

    Not found

  • 429

    rate_limited, or another limit named by error.code

Delete a hosted secret

DELETE /v1/hosting/secrets/{name} secrets:write

Path

  • name string required

Responses

  • 200

    Deleted

    Fields
    • data HostedSecretWrite required
      Fields
      • applied boolean required

        Whether the running hosted code has it now. False: none is running, or it couldn't be reached; the next deploy brings it.

  • 400

    Invalid request

  • 401

    Missing or invalid API key

  • 404

    Not found

  • 429

    rate_limited, or another limit named by error.code