Hello, I am trying to retrieve the secrets list fr...
# infisical-help
p
Hello, I am trying to retrieve the secrets list from the API, but I receive a "404 Not Found" error in response. cab anyone help me to figure out what is wrong? I can export the secrets with infisical-cli with same client id and secret. but when I try to get the secrets list with API, I get the error below. In the example below, I’ve replaced the real values with placeholders: # API Request
Copy code
export INFISICAL_API_URL='<https://infisical.local-server.com>'
export INFISICAL_CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export INFISICAL_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export INFISICAL_TOKEN=$(infisical login --method=universal-auth --client-id=$INFISICAL_CLIENT_ID --client-secret=$INFISICAL_CLIENT_SECRET --silent --plain)
SECRET_PATH="api"
PROJECT_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
SECRET_ENV_SLUG="stage"

curl --request GET \
  --url "$INFISICAL_API_URL/api/v4/secrets?secretPath=%2F$SECRET_PATH&viewSecretValue=false&expandSecretReferences=false&recursive=false&include_imports=false&environment=$SECRET_ENV_SLUG&projectId=$PROJECT_ID" \
  --header "Authorization: Bearer $INFISICAL_TOKEN" | jq
# Response
Copy code
{
  "message": "Route GET:/api/v4/secrets?secretPath=%2Fapi&viewSecretValue=false&expandSecretReferences=false&recursive=false&include_imports=false&environment=stage&projectId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx not found",
  "error": "Not Found",
  "statusCode": 404
}
a
You need to update your infisical instance to use v4 endpoint.