Skip to main content

Validate Container Registry

Validate that container registry credentials are correct and the registry is accessible before creating or updating a registry configuration.

Endpoint

POST /{companyId}/containerRegistryConfig/validate

Authentication

Required: Yes (Session or Bearer Token with 2FA)

Request Body

{
"url": "myregistry.azurecr.io",
"username": "myusername",
"password": "mypassword"
}

Request Fields

FieldTypeRequiredDescription
urlstringYesRegistry domain to validate
usernamestringNo*Username for authentication
passwordstringNo*Password or access token
tokenstringNo*Bearer token (alternative to username/password)

Note: Provide either username + password OR token for private registries. For public registries, credentials are optional.

Response

Success Response (200 OK)

Valid Credentials:

{
"valid": true,
"message": "registry validated successfully"
}

Invalid Credentials:

{
"valid": false,
"message": "authentication failed – invalid credentials"
}

Registry Unreachable:

{
"valid": false,
"message": "cannot reach registry"
}

Timeout:

{
"valid": false,
"message": "timeout – registry unreachable"
}

Error Responses

Status CodeDescription
400Bad Request - Missing or invalid URL
401Unauthorized - Invalid or missing authentication
500Internal Server Error

Examples

Example 1: Validate Azure Container Registry

curl -X POST "https://api.thevenin.cloud/{companyId}/containerRegistryConfig/validate" \
-H "Authorization: Bearer tvn_your_api_token_here" \
-H "Content-Type: application/json" \
-d '{
"url": "myregistry.azurecr.io",
"username": "myusername",
"password": "access-token-12345"
}'

Response (Success):

{
"valid": true,
"message": "registry validated successfully"
}

Example 2: Validate GitHub Container Registry

curl -X POST "https://api.thevenin.cloud/{companyId}/containerRegistryConfig/validate" \
-H "Authorization: Bearer tvn_your_api_token_here" \
-H "Content-Type: application/json" \
-d '{
"url": "ghcr.io",
"username": "myusername",
"password": "ghp_MyGitHubToken123"
}'

Example 3: Invalid Credentials

curl -X POST "https://api.thevenin.cloud/{companyId}/containerRegistryConfig/validate" \
-H "Authorization: Bearer tvn_your_api_token_here" \
-H "Content-Type: application/json" \
-d '{
"url": "myregistry.azurecr.io",
"username": "wrong",
"password": "invalid"
}'

Response (Failed):

{
"valid": false,
"message": "authentication failed – invalid credentials"
}

Example 4: Unreachable Registry

curl -X POST "https://api.thevenin.cloud/{companyId}/containerRegistryConfig/validate" \
-H "Authorization: Bearer tvn_your_api_token_here" \
-H "Content-Type: application/json" \
-d '{
"url": "nonexistent-registry.example.com",
"username": "user",
"password": "pass"
}'

Response:

{
"valid": false,
"message": "cannot reach registry"
}

Validation Process

The validation endpoint:

  1. Normalizes URL: Removes protocols (https://, http://) and trailing slashes
  2. Handles Docker Hub: Converts docker.io to registry-1.docker.io
  3. Creates Authenticator: From provided credentials (Basic or Bearer)
  4. Tests Connection: Attempts to ping registry with a test image reference
  5. Timeout: Maximum 15 seconds for validation
  6. Returns Result: Success, auth failure, unreachable, or timeout

Common Validation Results

ResultMeaningNext Steps
valid: trueCredentials work ✅Safe to create registry config
authentication failedWrong credentials ❌Check username/password/token
cannot reach registryNetwork/DNS issue ❌Verify registry URL
timeoutSlow/unreachable ⏱️Check registry status, try again
invalid registry URLMalformed URL ❌Fix URL format