Skip to content

SetVar

POST
/hopbox.v1.VarService/SetVar
curl --request POST \
--url https://example.com/hopbox.v1.VarService/SetVar \
--header 'Connect-Protocol-Version: 1' \
--header 'Connect-Timeout-Ms: 1000' \
--header 'Content-Type: application/json' \
--data '{ "orgId": "example", "name": "example", "value": "example", "secret": true, "scope": "VAR_SCOPE_UNSPECIFIED" }'

SetVar sets a value, and replaces the value with the same name and scope. Org admins and owners set shared and all values. Any member sets private values for its own machines. A retry gives the same end state, so it needs no idempotency key.

Connect-Protocol-Version
Connect-Protocol-Version

Define the version of the Connect protocol

number
Allowed value: 1

Define the version of the Connect protocol

Example

1
Connect-Timeout-Ms
Connect-Timeout-Ms

Define the timeout, in ms

number

Define the timeout, in ms

Example

1000
Media typeapplication/json
SetVarRequest

SetVarRequest describes the value.

object
orgId
org_id

Org_id is the UUID of the org. The default is the org of the API key, or else the personal org of the caller.

string | null
name
name

Name has 1 to 128 letters, digits, and underscores, and does not start with a digit. Some names are reserved, such as PATH, LD_PRELOAD, and every name that starts with HOPBOX_.

string
value
value

Value is valid UTF-8 without a NUL byte, at most 16 KiB. It can be empty and can hold newlines.

string
secret
secret

Secret seals the value, so that no call returns it.

boolean
scope
scope

Scope is the scope of the value. The default is shared.

string
Allowed values: VAR_SCOPE_UNSPECIFIED VAR_SCOPE_SHARED VAR_SCOPE_PRIVATE VAR_SCOPE_ALL

Success

Media typeapplication/json
SetVarResponse

SetVarResponse holds the value, without the value of a secret.

object
var
var
object
id
id

Id is the UUID of the value.

string
orgId
org_id

Org_id is the UUID of the org of the value.

string
name
name

Name is the name of the env var in the machine, such as DATABASE_URL.

string
scope
scope
string
Allowed values: VAR_SCOPE_UNSPECIFIED VAR_SCOPE_SHARED VAR_SCOPE_PRIVATE VAR_SCOPE_ALL
secret
secret

Secret is true for a sealed value.

boolean
value
value

Value is the value of an env var, and empty for a secret.

string
ownerAccountId
owner_account_id

Owner_account_id is the UUID of the account of a private value, and empty for a shared or an all value.

string
updaterAccountId
updater_account_id

Updater_account_id is the UUID of the account that set the value last, or empty after its deletion.

string
createTime
create_time

Create_time is the time of the first set of the value.

string format: date-time
updateTime
update_time

Update_time is the time of the last set of the value.

string format: date-time

Example

{
"var": {
"scope": "VAR_SCOPE_UNSPECIFIED",
"createTime": "2023-01-15T01:30:15.01Z",
"updateTime": "2023-01-15T01:30:15.01Z"
}
}

Error

Media typeapplication/json
Connect Error
object
code

The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].

string
Allowed values: canceled unknown invalid_argument deadline_exceeded not_found already_exists permission_denied resource_exhausted failed_precondition aborted out_of_range unimplemented internal unavailable data_loss unauthenticated
message

A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.

string
details

A list of messages that carry the error details. There is no limit on the number of messages.

Array<object>

Contains an arbitrary serialized message along with a @type that describes the type of the serialized message, with an additional debug field for ConnectRPC error details.

object
type

A URL that acts as a globally unique identifier for the type of the serialized message. For example: type.googleapis.com/google.rpc.ErrorInfo.

string
value

The Protobuf message, serialized as bytes and base64-encoded. The specific message type is identified by the type field.

string format: byte
debug
Debug

Deserialized error detail payload. The ‘type’ field indicates the schema. This field is for easier debugging and should not be relied upon for application logic.

object
key
additional properties
any
key
additional properties
any
key
additional properties
any

Example

{
"code": "canceled"
}