# UpdateWriteRepositoryCredentials updates a repository credential set with write access

`PUT /api/v1/write-repocreds/{creds.url}`

Authentication (security requirement alternatives):

```json
[
  {
    "bearer": []
  }
]
```

- bearer: apiKey, header Authorization. A token sent as `Authorization: Bearer <token>`. [API Docs](https://sourcey-argocd.pages.dev/developer-guide/api-docs/index.md#authorization) shows how to get one.

Parameters:

- `creds.url` (path, string, required) - URL is the URL to which these credentials match
  Type: string

Request body: application/json (required)

Type: object

Schema: [v1alpha1RepoCreds](https://sourcey-argocd.pages.dev/api/models/v1alpha1repocreds/index.md)

- `azureActiveDirectoryEndpoint` (optional)
  Type: string

- `azureServicePrincipalClientId` (optional)
  Type: string

- `azureServicePrincipalClientSecret` (optional)
  Type: string

- `azureServicePrincipalTenantId` (optional)
  Type: string

- `bearerToken` (optional)
  Type: string

- `enableOCI` (optional)
  Type: boolean

- `forceHttpBasicAuth` (optional)
  Type: boolean

- `gcpServiceAccountKey` (optional)
  Type: string

- `githubAppEnterpriseBaseUrl` (optional)
  Type: string

- `githubAppID` (optional)
  Type: integer, int64

- `githubAppInstallationID` (optional)
  Type: integer, int64

- `githubAppPrivateKey` (optional)
  Type: string

- `insecureOCIForceHttp` (optional)
  Type: boolean
  
  InsecureOCIForceHttp specifies whether the connection to the repository uses TLS at _all_. If true, no TLS. This flag is applicable for OCI repos only.

- `noProxy` (optional)
  Type: string

- `password` (optional)
  Type: string

- `proxy` (optional)
  Type: string

- `sshPrivateKey` (optional)
  Type: string

- `tlsClientCertData` (optional)
  Type: string

- `tlsClientCertKey` (optional)
  Type: string

- `type` (optional)
  Type: string
  
  Type specifies the type of the repoCreds. Can be either "git", "helm" or "oci". "git" is assumed if empty or absent.

- `url` (optional)
  Type: string

- `useAzureWorkloadIdentity` (optional)
  Type: boolean

- `username` (optional)
  Type: string

Responses:

- 200: A successful response.

Content type: application/json

Type: object

Schema: [v1alpha1RepoCreds](https://sourcey-argocd.pages.dev/api/models/v1alpha1repocreds/index.md)

- `azureActiveDirectoryEndpoint` (optional)
  Type: string

- `azureServicePrincipalClientId` (optional)
  Type: string

- `azureServicePrincipalClientSecret` (optional)
  Type: string

- `azureServicePrincipalTenantId` (optional)
  Type: string

- `bearerToken` (optional)
  Type: string

- `enableOCI` (optional)
  Type: boolean

- `forceHttpBasicAuth` (optional)
  Type: boolean

- `gcpServiceAccountKey` (optional)
  Type: string

- `githubAppEnterpriseBaseUrl` (optional)
  Type: string

- `githubAppID` (optional)
  Type: integer, int64

- `githubAppInstallationID` (optional)
  Type: integer, int64

- `githubAppPrivateKey` (optional)
  Type: string

- `insecureOCIForceHttp` (optional)
  Type: boolean
  
  InsecureOCIForceHttp specifies whether the connection to the repository uses TLS at _all_. If true, no TLS. This flag is applicable for OCI repos only.

- `noProxy` (optional)
  Type: string

- `password` (optional)
  Type: string

- `proxy` (optional)
  Type: string

- `sshPrivateKey` (optional)
  Type: string

- `tlsClientCertData` (optional)
  Type: string

- `tlsClientCertKey` (optional)
  Type: string

- `type` (optional)
  Type: string
  
  Type specifies the type of the repoCreds. Can be either "git", "helm" or "oci". "git" is assumed if empty or absent.

- `url` (optional)
  Type: string

- `useAzureWorkloadIdentity` (optional)
  Type: boolean

- `username` (optional)
  Type: string

- default: An unexpected error response.

Content type: application/json

Type: object

Schema: [runtimeError](https://sourcey-argocd.pages.dev/api/models/runtimeerror/index.md)

- `code` (optional)
  Type: integer, int32

- `details` (optional)
  Type: array
  
  Items:
    Reference: [protobufAny](https://sourcey-argocd.pages.dev/api/models/protobufany/index.md); Type: object

- `error` (optional)
  Type: string

- `message` (optional)
  Type: string

## Examples

### cURL

```bash
curl -X PUT 'https://argocd.example.com/api/v1/write-repocreds/string' \
  -H 'Authorization: YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "azureActiveDirectoryEndpoint": "string",
  "azureServicePrincipalClientId": "string",
  "azureServicePrincipalClientSecret": "string",
  "azureServicePrincipalTenantId": "string",
  "bearerToken": "string",
  "enableOCI": true,
  "forceHttpBasicAuth": true,
  "gcpServiceAccountKey": "string",
  "githubAppEnterpriseBaseUrl": "string",
  "githubAppID": 0,
  "githubAppInstallationID": 0,
  "githubAppPrivateKey": "string",
  "insecureOCIForceHttp": true,
  "noProxy": "string",
  "password": "string",
  "proxy": "string",
  "sshPrivateKey": "string",
  "tlsClientCertData": "string",
  "tlsClientCertKey": "string",
  "type": "string",
  "url": "string",
  "useAzureWorkloadIdentity": true,
  "username": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "azureActiveDirectoryEndpoint": "string",
  "azureServicePrincipalClientId": "string",
  "azureServicePrincipalClientSecret": "string",
  "azureServicePrincipalTenantId": "string",
  "bearerToken": "string",
  "enableOCI": true,
  "forceHttpBasicAuth": true,
  "gcpServiceAccountKey": "string",
  "githubAppEnterpriseBaseUrl": "string",
  "githubAppID": 0,
  "githubAppInstallationID": 0,
  "githubAppPrivateKey": "string",
  "insecureOCIForceHttp": true,
  "noProxy": "string",
  "password": "string",
  "proxy": "string",
  "sshPrivateKey": "string",
  "tlsClientCertData": "string",
  "tlsClientCertKey": "string",
  "type": "string",
  "url": "string",
  "useAzureWorkloadIdentity": true,
  "username": "string"
}`;

const response = await fetch('https://argocd.example.com/api/v1/write-repocreds/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "azureActiveDirectoryEndpoint": "string",
  "azureServicePrincipalClientId": "string",
  "azureServicePrincipalClientSecret": "string",
  "azureServicePrincipalTenantId": "string",
  "bearerToken": "string",
  "enableOCI": true,
  "forceHttpBasicAuth": true,
  "gcpServiceAccountKey": "string",
  "githubAppEnterpriseBaseUrl": "string",
  "githubAppID": 0,
  "githubAppInstallationID": 0,
  "githubAppPrivateKey": "string",
  "insecureOCIForceHttp": true,
  "noProxy": "string",
  "password": "string",
  "proxy": "string",
  "sshPrivateKey": "string",
  "tlsClientCertData": "string",
  "tlsClientCertKey": "string",
  "type": "string",
  "url": "string",
  "useAzureWorkloadIdentity": true,
  "username": "string"
}'''

response = requests.put(
    'https://argocd.example.com/api/v1/write-repocreds/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
