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.
Create a key
Section titled “Create a key”You need the admin or billing role in the workspace.
- 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.
- Click Create access key.
- 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.
- 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
curlcommand 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.
Last used
Section titled “Last used”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
Section titled “Send the key”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.
export URL="https://..." # the port's URL from the Connect tabexport 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-Keycurl "$URL/" -H "X-Meshive-Key: $MESHIVE_ACCESS_KEY" -H "Authorization: Bearer $APP_TOKEN"import osimport httpx
url = os.environ["URL"] # the port's URL from the Connect tabkey = os.environ["MESHIVE_ACCESS_KEY"]
r = httpx.get(f"{url}/", headers={"Authorization": f"Bearer {key}"})r.raise_for_status()
# The app checks its own Authorization header: send the key in X-Meshive-Keyr = httpx.get(f"{url}/", headers={"X-Meshive-Key": key, "Authorization": f"Bearer {os.environ['APP_TOKEN']}"})import osfrom websockets.sync.client import connect # pip install websockets
url = os.environ["URL"].replace("https://", "wss://", 1)key = os.environ["MESHIVE_ACCESS_KEY"]
with connect(f"{url}/ws", additional_headers={"Authorization": f"Bearer {key}"}) as ws: ws.send("hello") print(ws.recv())Send the key when the connection opens. A connection that is already open stays open even if the key is revoked later.
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 osfrom 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.
The server in the Pod was started with its own API key (for example --api-key). Keep that key as the client’s API key and add the access key in X-Meshive-Key:
import osfrom openai import OpenAI
client = OpenAI(base_url=os.environ["URL"] + "/v1", api_key=os.environ["APP_API_KEY"], default_headers={"X-Meshive-Key": os.environ["MESHIVE_ACCESS_KEY"]})print(client.models.list())Apps that can’t send a key
Section titled “Apps that can’t send a key”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.
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 a key
Section titled “Roll a key”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.
- Click Roll in the key’s row.
- 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.
- Click Roll and copy the new value. It is shown once, like a new key.
- 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.
Roll an expired key
Section titled “Roll an expired key”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.
Revoke a key
Section titled “Revoke a key”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.
Expiry emails
Section titled “Expiry emails”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.
When a member leaves
Section titled “When a member leaves”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.
Keys and port changes
Section titled “Keys and port changes”| Change | What happens to the port’s keys |
|---|---|
| Unlock the port | Kept. 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 using | Kept. The URL stays the same. |
| Change the port number in any other way | Keys 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 Internal | All of them are revoked. |
| Delete the Pod | All of them stop working. |
From the SDK and CLI
Section titled “From the SDK and CLI”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.
meshive port-key-create <workspace> <pod> <port> --name ci # prints the value oncemeshive port-key-create <workspace> <pod> <port> --name ci --expires nevermeshive port-keys <workspace> <pod> <port> # names and first charactersmeshive port-key-roll <workspace> <pod> <port> <key-id> --overlap 24hmeshive 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 logsSee Locked ports and access keys in the SDK reference and meshive port-key-create in the CLI reference.
Limits
Section titled “Limits”- 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.
Troubleshooting
Section titled “Troubleshooting”| You might see | It means | Do |
|---|---|---|
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 revoked | Check the header name and the port, and look the key up in Access keys |
401 from your app after you added the key to Authorization | Your app checks its own Authorization header, and the access key was removed before it got there | Send the access key in X-Meshive-Key and keep your app’s own token in Authorization |
| Create access key is turned off | You are a viewer in this workspace | Ask an admin or billing member |
| No Access keys section on the Connect tab | The Pod has no locked port | Lock a port first |
| Roll is turned off for a key | The key’s port is unlocked right now | Lock the port to roll its keys |
| A page on another site gets a CORS error even with a key | The browser’s preflight check carries no key | See Allow preflight |
| Too Many Keys | The port already has the most keys it can hold | Revoke a key you no longer use |
| A program keeps working after you revoked its key | It still has a connection open from before | Restart the program or close the connection; new connections are refused |