Skip to main content

Snowflake User Key-Pair

Yuki connects to Snowflake as each of your service users with key-pair authentication. This endpoint sets that up without the Yuki app: Yuki generates a key-pair for the user, keeps the private key, and returns the public key for you to set on the user in Snowflake.

Use it to add a user to Yuki, and call it again to rotate the user's key.

POST /v1/snowflake-users/key-pair
Content-Type: application/json
{ "userName": "DBT_USER" }
FieldDescription
userNameThe Snowflake user name, made of letters, digits and _+=.@-. Yuki matches it ignoring case.

Example​

curl -X POST https://prod.yukicomputing.com/v1/snowflake-users/key-pair \
-H "Authorization: Bearer $YUKI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"userName": "DBT_USER"}'
{
"userName": "DBT_USER",
"publicKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."
}

Set the public key in Snowflake​

Set the returned publicKey on the user:

ALTER USER DBT_USER SET RSA_PUBLIC_KEY_2 = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...';

Snowflake keeps two public keys per user, RSA_PUBLIC_KEY and RSA_PUBLIC_KEY_2. Use the one your own clients don't use, so they keep working with their key while Yuki uses its own.

Rotate the key​

Call the endpoint again for the same user. Yuki generates a new key-pair and switches to the new private key at once, so set the new publicKey on the user straight away, in the same place as before. Until you do, Yuki can't open new Snowflake sessions as that user.

What Yuki stores​

  • An RSA 2048-bit key-pair. Yuki generates a new one on every call.
  • The private key, encrypted in Yuki's AWS Secrets Manager. The API never returns it.
  • If the user was set up with a key in your own cloud's secret manager or in your proxy's environment, Yuki switches the user to the key it generates.

Response​

StatusMeaning
200 OKThe key-pair is saved. The body has userName and publicKey.
400 Bad RequestuserName is empty or has other characters, or the account isn't a Snowflake account.
401 UnauthorizedThe Yuki API key is missing or wrong. See Authentication.
500 Internal Server ErrorYuki couldn't save the key-pair. Don't set the public key from this call. Try again.