Skip to content
Console

Access keys

How programs call a locked Pod port — create an access key, send it in a header, and roll or revoke it when it should stop working.

An access key lets a program — a script, a CI job, another service — call a locked port. People don’t need one: workspace members open locked ports in their browser.

  • A key opens one port of one Pod. Each port has its own keys.
  • A key starts with mshv_. It is not your Meshive API key and can’t do anything else on your account.
  • Meshive shows a key’s value once, when it is created. Afterwards only its first characters are shown.

You need the admin or billing role in the workspace.

  1. Open the Pod and go to the Connect tab. The Access keys section is below Endpoints; it appears once the Pod has a locked port.
  2. Click Create access key.
  3. Fill in the form:
    • Name — a label to recognize the key later, such as the program that will use it. If you leave it empty, the port’s name is used.
    • Port — the locked port the key opens. Only locked public ports are listed.
    • Expiration — 30 days, 90 days (the default), 365 days or No expiration. The key stops working after this period.
  4. Click Create, then copy the key from Access key created. For security reasons it won’t be shown again. The dialog also has a ready-made curl command for the port with the key filled in.

The list under Access keys shows each key’s Name, the first characters of the Key, its Port, when it was Created, when it Expires and when it was Last used. A key that expires within 7 days is marked, for example Nov 19, 2026 · in 5 days. A key that has expired stays in the list for 30 days, marked expired with the note Expired — roll it to issue a new value. After 30 days it leaves the list.

From the command line or Python, see Access keys in the SDK and CLI.

The Last used column shows when a program last got through with the key: Just now, 25 minutes ago, 2 hours ago, 3 days ago, or Never if no program has used it. It is updated every few minutes, so a key used a moment ago can show an older time.

Use it to find keys nobody uses any more. A key that says Never, or a long time ago, is a good one to revoke. The CLI shows the same in the LAST USED column of meshive port-keys, the SDK has last_used_at on each key, and the MCP server’s access_keys tool returns last_used_at.

Send the key in the Authorization header of every request:

Authorization: Bearer mshv_...

The key is checked before the request reaches your app, and then removed from the request: your app never sees it.

If your app uses the Authorization header itself — for example an API that checks its own bearer token — send the access key in X-Meshive-Key instead, and keep your app’s own Authorization header as it is:

X-Meshive-Key: mshv_...

The examples below read the port’s URL (from the Connect tab) and the key from environment variables, so the key stays out of your code.

Terminal window
export URL="https://..." # the port's URL from the Connect tab
export MESHIVE_ACCESS_KEY="mshv_..." # the access key
curl "$URL/" -H "Authorization: Bearer $MESHIVE_ACCESS_KEY"
# The app checks its own Authorization header: send the key in X-Meshive-Key
curl "$URL/" -H "X-Meshive-Key: $MESHIVE_ACCESS_KEY" -H "Authorization: Bearer $APP_TOKEN"

OpenAI-compatible servers and other bearer-token clients

Section titled “OpenAI-compatible servers and other bearer-token clients”

Clients built for OpenAI-compatible APIs, and many other SDKs, put their API key in Authorization: Bearer. Which header carries the access key depends on whether the server in your Pod checks that token too:

The server in the Pod (for example vLLM or SGLang started without an API key) doesn’t check Authorization. Pass the access key as the client’s API key:

import os
from openai import OpenAI
client = OpenAI(base_url=os.environ["URL"] + "/v1",
api_key=os.environ["MESHIVE_ACCESS_KEY"])
print(client.models.list())

The access key is removed before the request reaches the server, so the server sees no Authorization header at all.

Some apps take only an address: a desktop client, an IDE plugin, a tool that can’t add a header. Run meshive port-forward on your computer with one of the port’s keys, and give the app http://127.0.0.1:<port> instead of the port’s URL. The forwarder adds the key to every request, WebSockets included.

Terminal window
export MESHIVE_ACCESS_KEY="mshv_..."
meshive port-forward <workspace> <pod> <port>

The key comes from MESHIVE_ACCESS_KEY or from --key-file, never from the command line. The forwarder answers only on 127.0.0.1 and refuses requests made by web pages on other sites. Other programs on your computer can still use it without a key, so run it only on a computer you trust and stop it with Ctrl+C when you are done. See meshive port-forward for the options and for Windows PowerShell.

Roll gives a key a new value and keeps its name and port. Use it to replace a value that may have leaked, for example after someone who knew it leaves the workspace, or before it expires.

  1. Click Roll in the key’s row.
  2. Choose when the Previous value stops working: Now, In 1 hour (the default), In 24 hours or In 7 days. Keep it as short as you can.
  3. Click Roll and copy the new value. It is shown once, like a new key.
  4. Update your programs with the new value before the previous one stops working.

Until then, the key’s row says Previous value works until …. The new value gets a fresh period of the same length it had — a 90-day key is good for 90 days from the roll — and a key with No expiration stays without one.

You can roll a key for 30 days after it expires. Its old value stopped working when it expired, so there is nothing to overlap: the Previous value stops working choice isn’t shown. The window says This key has expired, so its old value no longer works. Rolling creates a new value with the same name, port and lifetime. The new value starts working at once and is good for the key’s full period from now. Copy it, as with any roll. The result says Previous value had already expired.

A key that has been expired for more than 30 days is gone from the list. Create a new key instead.

Click Revoke in the key’s row and confirm. You can also revoke a key that has expired, while it is still in the list. Revoking … will immediately break any program using it. This cannot be undone. A revoked key — and a previous value that was still working after a roll — stops working for new requests within a few seconds. A WebSocket that was already open with the key stays open until it closes. To give the program access again, create a new key.

Meshive emails you about a key that expires: 7 days before it expires, and when it has expired. The email names the key, the Pod and the port, and links to the Pod’s Connect tab. Roll the key before it expires. An expired key stops working, but it stays in the list for 30 days, and you can still roll it to issue a new value.

The email goes to whoever created or last rolled the key, if they are still an admin or billing member of the workspace. Otherwise it goes to all of the workspace’s admin and billing members.

Removing a member from the workspace ends their browser access to its locked ports within a few seconds. Access keys keep working — a key belongs to the port, not to the person who created it, and that includes keys the removed member created. Programs often run with keys that someone else created.

The Remove member dialog tells you how many access keys the workspace has. If the member knew any of them, Roll those keys.

ChangeWhat happens to the port’s keys
Unlock the portKept. They aren’t needed while it is open, and they work again when you lock it again.
Change the port number of a port that came with the template, to a number the Pod isn’t usingKept. The URL stays the same.
Change the port number in any other wayKeys stay with the URL, not with the app. A port that gets a new URL starts with no keys — create new ones. A port moved onto a number another port had been using takes over that port’s URL and keys. See Changing a port later.
Switch the port from Public to InternalAll of them are revoked.
Delete the PodAll of them stop working.

The Python SDK and CLI manage keys from 1.10.0, with a Read & write API key of an admin or billing member. Listing keys works with a read-only key.

Terminal window
meshive port-key-create <workspace> <pod> <port> --name ci # prints the value once
meshive port-key-create <workspace> <pod> <port> --name ci --expires never
meshive port-keys <workspace> <pod> <port> # names and first characters
meshive port-key-roll <workspace> <pod> <port> <key-id> --overlap 24h
meshive port-key-revoke <workspace> <pod> <port> <key-id>
from meshive import Meshive
with Meshive() as client:
created = client.create_access_key("<pod>", "<workspace>", 3000, "ci", expires_in_days=90)
key = created.access_key # returned this once: put it in your secret store, not in logs

See Locked ports and access keys in the SDK reference and meshive port-key-create in the CLI reference.

  • A port can have up to 10 keys at a time; revoke one you no longer use to make room. This limit may change. Keys that have expired don’t count toward it.
  • A key opens a port only while the port is locked and Public.
  • Last used is updated every few minutes, so it can lag a little.
You might seeIt meansDo
401 with {"error":"unauthorized"}No working key reached the port: the header is missing or misspelled, the key is for another port, or it expired or was revokedCheck the header name and the port, and look the key up in Access keys
401 from your app after you added the key to AuthorizationYour app checks its own Authorization header, and the access key was removed before it got thereSend the access key in X-Meshive-Key and keep your app’s own token in Authorization
Create access key is turned offYou are a viewer in this workspaceAsk an admin or billing member
No Access keys section on the Connect tabThe Pod has no locked portLock a port first
Roll is turned off for a keyThe key’s port is unlocked right nowLock the port to roll its keys
A page on another site gets a CORS error even with a keyThe browser’s preflight check carries no keySee Allow preflight
Too Many KeysThe port already has the most keys it can holdRevoke a key you no longer use
A program keeps working after you revoked its keyIt still has a connection open from beforeRestart the program or close the connection; new connections are refused