# UpdateSpec updates an application spec

`PUT /api/v1/applications/{name}/spec`

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:

- `name` (path, string, required)
  Type: string

- `validate` (query, boolean, optional)
  Type: boolean

- `appNamespace` (query, string, optional)
  Type: string

- `project` (query, string, optional)
  Type: string

Request body: application/json (required)

Type: object

ApplicationSpec represents desired application state. Contains link to repository with application definition and additional parameters link definition revision.

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

- `destination` (optional)
  Reference: [v1alpha1ApplicationDestination](https://sourcey-argocd.pages.dev/api/models/v1alpha1applicationdestination/index.md); Type: object

- `ignoreDifferences` (optional)
  Type: array
  
  Items:
    Reference: [v1alpha1ResourceIgnoreDifferences](https://sourcey-argocd.pages.dev/api/models/v1alpha1resourceignoredifferences/index.md); Type: object
    
    ResourceIgnoreDifferences contains resource filter and list of json paths which should be ignored during comparison with live state.

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

- `project` (optional)
  Type: string
  
  Project is a reference to the project this application belongs to.
  The empty string means that application belongs to the 'default' project.

- `revisionHistoryLimit` (optional)
  Type: integer, int64
  
  RevisionHistoryLimit limits the number of items kept in the application's revision history, which is used for informational purposes as well as for rollbacks to previous versions.
  This should only be changed in exceptional circumstances.
  Setting to zero will store no history. This will reduce storage used.
  Increasing will increase the space used to store the history, so we do not recommend increasing it.
  Default is 10.

- `source` (optional)
  Reference: [v1alpha1ApplicationSource](https://sourcey-argocd.pages.dev/api/models/v1alpha1applicationsource/index.md); Type: object

- `sourceHydrator` (optional)
  Reference: [v1alpha1SourceHydrator](https://sourcey-argocd.pages.dev/api/models/v1alpha1sourcehydrator/index.md); Type: object
  
  SourceHydrator specifies a dry "don't repeat yourself" source for manifests, a sync source from which to sync
  hydrated manifests, and an optional hydrateTo location to act as a "staging" aread for hydrated manifests.

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

- `syncPolicy` (optional)
  Reference: [v1alpha1SyncPolicy](https://sourcey-argocd.pages.dev/api/models/v1alpha1syncpolicy/index.md); Type: object

Responses:

- 200: A successful response.

Content type: application/json

Type: object

ApplicationSpec represents desired application state. Contains link to repository with application definition and additional parameters link definition revision.

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

- `destination` (optional)
  Reference: [v1alpha1ApplicationDestination](https://sourcey-argocd.pages.dev/api/models/v1alpha1applicationdestination/index.md); Type: object

- `ignoreDifferences` (optional)
  Type: array
  
  Items:
    Reference: [v1alpha1ResourceIgnoreDifferences](https://sourcey-argocd.pages.dev/api/models/v1alpha1resourceignoredifferences/index.md); Type: object
    
    ResourceIgnoreDifferences contains resource filter and list of json paths which should be ignored during comparison with live state.

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

- `project` (optional)
  Type: string
  
  Project is a reference to the project this application belongs to.
  The empty string means that application belongs to the 'default' project.

- `revisionHistoryLimit` (optional)
  Type: integer, int64
  
  RevisionHistoryLimit limits the number of items kept in the application's revision history, which is used for informational purposes as well as for rollbacks to previous versions.
  This should only be changed in exceptional circumstances.
  Setting to zero will store no history. This will reduce storage used.
  Increasing will increase the space used to store the history, so we do not recommend increasing it.
  Default is 10.

- `source` (optional)
  Reference: [v1alpha1ApplicationSource](https://sourcey-argocd.pages.dev/api/models/v1alpha1applicationsource/index.md); Type: object

- `sourceHydrator` (optional)
  Reference: [v1alpha1SourceHydrator](https://sourcey-argocd.pages.dev/api/models/v1alpha1sourcehydrator/index.md); Type: object
  
  SourceHydrator specifies a dry "don't repeat yourself" source for manifests, a sync source from which to sync
  hydrated manifests, and an optional hydrateTo location to act as a "staging" aread for hydrated manifests.

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

- `syncPolicy` (optional)
  Reference: [v1alpha1SyncPolicy](https://sourcey-argocd.pages.dev/api/models/v1alpha1syncpolicy/index.md); Type: object

- 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/applications/string/spec' \
  -H 'Authorization: YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "destination": {
    "name": "string",
    "namespace": "string",
    "server": "string"
  },
  "ignoreDifferences": [
    {
      "group": "string",
      "jqPathExpressions": [
        "string"
      ],
      "jsonPointers": [
        "string"
      ],
      "kind": "string",
      "managedFieldsManagers": [
        "string"
      ],
      "name": "string",
      "namespace": "string"
    }
  ],
  "info": [
    {
      "name": "string",
      "value": "string"
    }
  ],
  "project": "string",
  "revisionHistoryLimit": 0,
  "source": {
    "chart": "string",
    "directory": {
      "disableExtensionFilter": true,
      "exclude": "string",
      "include": "string",
      "jsonnet": {
        "extVars": [
          {
            "code": true,
            "name": "string",
            "value": "string"
          }
        ],
        "libs": [
          "string"
        ]
      },
      "recurse": true
    },
    "helm": {
      "apiVersions": [
        "string"
      ],
      "fileParameters": [
        {
          "name": "string",
          "path": "string"
        }
      ],
      "ignoreMissingValueFiles": true,
      "kubeVersion": "string",
      "namespace": "string",
      "parameters": [
        {
          "forceString": true,
          "name": "string",
          "value": "string"
        }
      ],
      "passCredentials": true,
      "releaseName": "string",
      "skipCrds": true,
      "skipSchemaValidation": true,
      "skipTests": true,
      "valueFiles": [
        "string"
      ],
      "values": "string",
      "valuesObject": {
        "raw": "dGVzdA=="
      },
      "version": "string"
    },
    "kustomize": {
      "apiVersions": [
        "string"
      ],
      "commonAnnotations": {},
      "commonAnnotationsEnvsubst": true,
      "commonLabels": {},
      "components": [
        "string"
      ],
      "forceCommonAnnotations": true,
      "forceCommonLabels": true,
      "ignoreMissingComponents": true,
      "images": [
        "string"
      ],
      "kubeVersion": "string",
      "labelIncludeTemplates": true,
      "labelWithoutSelector": true,
      "namePrefix": "string",
      "nameSuffix": "string",
      "namespace": "string",
      "patches": [
        {
          "options": {},
          "patch": "string",
          "path": "string",
          "target": {
            "annotationSelector": "string",
            "labelSelector": "string",
            "resId": {
              "gvk": {
                "group": "string",
                "kind": "string",
                "version": "string"
              },
              "name": "string",
              "namespace": "string"
            }
          }
        }
      ],
      "replicas": [
        {
          "count": {
            "intVal": 0,
            "strVal": "string",
            "type": 0
          },
          "name": "string"
        }
      ],
      "version": "string"
    },
    "name": "string",
    "path": "string",
    "plugin": {
      "env": [
        {
          "name": "string",
          "value": "string"
        }
      ],
      "name": "string",
      "parameters": [
        {
          "array": [
            "string"
          ],
          "map": {},
          "name": "string",
          "string": "string"
        }
      ]
    },
    "ref": "string",
    "repoURL": "string",
    "tagPrefix": "string",
    "targetRevision": "string"
  },
  "sourceHydrator": {
    "drySource": {
      "path": "string",
      "repoURL": "string",
      "targetRevision": "string"
    },
    "hydrateTo": {
      "targetBranch": "string"
    },
    "syncSource": {
      "path": "string",
      "repoURL": "string",
      "targetBranch": "string"
    }
  },
  "syncPolicy": {
    "automated": {
      "allowEmpty": true,
      "enabled": true,
      "prune": true,
      "selfHeal": true
    },
    "managedNamespaceMetadata": {
      "annotations": {},
      "labels": {}
    },
    "retry": {
      "backoff": {
        "duration": "string",
        "factor": 0,
        "maxDuration": "string"
      },
      "limit": 0,
      "refresh": true
    },
    "syncOptions": [
      "string"
    ]
  }
}'
```

### JavaScript

```javascript
const body = `{
  "destination": {
    "name": "string",
    "namespace": "string",
    "server": "string"
  },
  "ignoreDifferences": [
    {
      "group": "string",
      "jqPathExpressions": [
        "string"
      ],
      "jsonPointers": [
        "string"
      ],
      "kind": "string",
      "managedFieldsManagers": [
        "string"
      ],
      "name": "string",
      "namespace": "string"
    }
  ],
  "info": [
    {
      "name": "string",
      "value": "string"
    }
  ],
  "project": "string",
  "revisionHistoryLimit": 0,
  "source": {
    "chart": "string",
    "directory": {
      "disableExtensionFilter": true,
      "exclude": "string",
      "include": "string",
      "jsonnet": {
        "extVars": [
          {
            "code": true,
            "name": "string",
            "value": "string"
          }
        ],
        "libs": [
          "string"
        ]
      },
      "recurse": true
    },
    "helm": {
      "apiVersions": [
        "string"
      ],
      "fileParameters": [
        {
          "name": "string",
          "path": "string"
        }
      ],
      "ignoreMissingValueFiles": true,
      "kubeVersion": "string",
      "namespace": "string",
      "parameters": [
        {
          "forceString": true,
          "name": "string",
          "value": "string"
        }
      ],
      "passCredentials": true,
      "releaseName": "string",
      "skipCrds": true,
      "skipSchemaValidation": true,
      "skipTests": true,
      "valueFiles": [
        "string"
      ],
      "values": "string",
      "valuesObject": {
        "raw": "dGVzdA=="
      },
      "version": "string"
    },
    "kustomize": {
      "apiVersions": [
        "string"
      ],
      "commonAnnotations": {},
      "commonAnnotationsEnvsubst": true,
      "commonLabels": {},
      "components": [
        "string"
      ],
      "forceCommonAnnotations": true,
      "forceCommonLabels": true,
      "ignoreMissingComponents": true,
      "images": [
        "string"
      ],
      "kubeVersion": "string",
      "labelIncludeTemplates": true,
      "labelWithoutSelector": true,
      "namePrefix": "string",
      "nameSuffix": "string",
      "namespace": "string",
      "patches": [
        {
          "options": {},
          "patch": "string",
          "path": "string",
          "target": {
            "annotationSelector": "string",
            "labelSelector": "string",
            "resId": {
              "gvk": {
                "group": "string",
                "kind": "string",
                "version": "string"
              },
              "name": "string",
              "namespace": "string"
            }
          }
        }
      ],
      "replicas": [
        {
          "count": {
            "intVal": 0,
            "strVal": "string",
            "type": 0
          },
          "name": "string"
        }
      ],
      "version": "string"
    },
    "name": "string",
    "path": "string",
    "plugin": {
      "env": [
        {
          "name": "string",
          "value": "string"
        }
      ],
      "name": "string",
      "parameters": [
        {
          "array": [
            "string"
          ],
          "map": {},
          "name": "string",
          "string": "string"
        }
      ]
    },
    "ref": "string",
    "repoURL": "string",
    "tagPrefix": "string",
    "targetRevision": "string"
  },
  "sourceHydrator": {
    "drySource": {
      "path": "string",
      "repoURL": "string",
      "targetRevision": "string"
    },
    "hydrateTo": {
      "targetBranch": "string"
    },
    "syncSource": {
      "path": "string",
      "repoURL": "string",
      "targetBranch": "string"
    }
  },
  "syncPolicy": {
    "automated": {
      "allowEmpty": true,
      "enabled": true,
      "prune": true,
      "selfHeal": true
    },
    "managedNamespaceMetadata": {
      "annotations": {},
      "labels": {}
    },
    "retry": {
      "backoff": {
        "duration": "string",
        "factor": 0,
        "maxDuration": "string"
      },
      "limit": 0,
      "refresh": true
    },
    "syncOptions": [
      "string"
    ]
  }
}`;

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

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

### Python

```python
import requests

body = '''{
  "destination": {
    "name": "string",
    "namespace": "string",
    "server": "string"
  },
  "ignoreDifferences": [
    {
      "group": "string",
      "jqPathExpressions": [
        "string"
      ],
      "jsonPointers": [
        "string"
      ],
      "kind": "string",
      "managedFieldsManagers": [
        "string"
      ],
      "name": "string",
      "namespace": "string"
    }
  ],
  "info": [
    {
      "name": "string",
      "value": "string"
    }
  ],
  "project": "string",
  "revisionHistoryLimit": 0,
  "source": {
    "chart": "string",
    "directory": {
      "disableExtensionFilter": true,
      "exclude": "string",
      "include": "string",
      "jsonnet": {
        "extVars": [
          {
            "code": true,
            "name": "string",
            "value": "string"
          }
        ],
        "libs": [
          "string"
        ]
      },
      "recurse": true
    },
    "helm": {
      "apiVersions": [
        "string"
      ],
      "fileParameters": [
        {
          "name": "string",
          "path": "string"
        }
      ],
      "ignoreMissingValueFiles": true,
      "kubeVersion": "string",
      "namespace": "string",
      "parameters": [
        {
          "forceString": true,
          "name": "string",
          "value": "string"
        }
      ],
      "passCredentials": true,
      "releaseName": "string",
      "skipCrds": true,
      "skipSchemaValidation": true,
      "skipTests": true,
      "valueFiles": [
        "string"
      ],
      "values": "string",
      "valuesObject": {
        "raw": "dGVzdA=="
      },
      "version": "string"
    },
    "kustomize": {
      "apiVersions": [
        "string"
      ],
      "commonAnnotations": {},
      "commonAnnotationsEnvsubst": true,
      "commonLabels": {},
      "components": [
        "string"
      ],
      "forceCommonAnnotations": true,
      "forceCommonLabels": true,
      "ignoreMissingComponents": true,
      "images": [
        "string"
      ],
      "kubeVersion": "string",
      "labelIncludeTemplates": true,
      "labelWithoutSelector": true,
      "namePrefix": "string",
      "nameSuffix": "string",
      "namespace": "string",
      "patches": [
        {
          "options": {},
          "patch": "string",
          "path": "string",
          "target": {
            "annotationSelector": "string",
            "labelSelector": "string",
            "resId": {
              "gvk": {
                "group": "string",
                "kind": "string",
                "version": "string"
              },
              "name": "string",
              "namespace": "string"
            }
          }
        }
      ],
      "replicas": [
        {
          "count": {
            "intVal": 0,
            "strVal": "string",
            "type": 0
          },
          "name": "string"
        }
      ],
      "version": "string"
    },
    "name": "string",
    "path": "string",
    "plugin": {
      "env": [
        {
          "name": "string",
          "value": "string"
        }
      ],
      "name": "string",
      "parameters": [
        {
          "array": [
            "string"
          ],
          "map": {},
          "name": "string",
          "string": "string"
        }
      ]
    },
    "ref": "string",
    "repoURL": "string",
    "tagPrefix": "string",
    "targetRevision": "string"
  },
  "sourceHydrator": {
    "drySource": {
      "path": "string",
      "repoURL": "string",
      "targetRevision": "string"
    },
    "hydrateTo": {
      "targetBranch": "string"
    },
    "syncSource": {
      "path": "string",
      "repoURL": "string",
      "targetBranch": "string"
    }
  },
  "syncPolicy": {
    "automated": {
      "allowEmpty": true,
      "enabled": true,
      "prune": true,
      "selfHeal": true
    },
    "managedNamespaceMetadata": {
      "annotations": {},
      "labels": {}
    },
    "retry": {
      "backoff": {
        "duration": "string",
        "factor": 0,
        "maxDuration": "string"
      },
      "limit": 0,
      "refresh": true
    },
    "syncOptions": [
      "string"
    ]
  }
}'''

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