# Update an application

Updates an existing error tracking application. Send only the parameters you wish to change.

[endpoint]
base_url = "https://errors.betterstack.com"
path = "/api/v1/applications/{id}"
method = "PATCH"

[[path_param]]
name = "id"
description = "The ID of the application to update."
required = true
type = "string"

[[body_param]]
name = "name"
description = "New application name. Must be unique within your team."
required = false
type = "string"

[[body_param]]
name = "errors_retention"
description = "New error data retention period in days."
required = false
type = "integer"

[[body_param]]
name = "ingesting_paused"
description = "Set to `true` to pause error ingestion, `false` to resume."
required = false
type = "boolean"

[[body_param]]
name = "code_mapping_stack_root"
description = "The absolute path to the root of the stack trace on your server (e.g., `/usr/src/app/`). This is used to resolve source code paths for AI-assisted debugging."
required = false
type = "string"

[[body_param]]
name = "code_mapping_source_root"
description = "The relative path from your project's root to the source code being deployed (e.g., `apps/backend/`). This is used to resolve source code paths for AI-assisted debugging."
required = false
type = "string"

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"

[[header]]
name = "Content-Type"
description = "application/json"
required = true
type = "string"
[/endpoint]

[responses]
[[response]]
status = 200
description = '''Returns the updated application.'''
body = '''{
  "data": {
    "id": "1234",
    "type": "application",
    "attributes": {
      "application_group_id": 5678,
      "team_id": 123456,
      "team_name": "example-team",
      "name": "updated-web-app",
      "table_name": "updated_web_app",
      "token": "abc123def456ghi789",
      "ingesting_paused": false,
      "ingesting_host": "s1234.us-east-9.betterstackdata.com",
      "created_at": "2025-01-15T10:30:00.000Z",
      "updated_at": "2025-01-15T10:35:00.000Z",
      "errors_retention": 90,
      "data_region": "us-east-9",
      "custom_bucket": null,
      "code_mapping_stack_root": "/usr/src/app/",
      "code_mapping_source_root": "apps/backend/"
    }
  }
}'''

[[response]]
status = 401
description = '''Unauthorized'''
body = '''{
  "errors": "Invalid authentication"
}'''

[[response]]
status = 404
description = '''Not Found'''
body = '''{
  "errors": "Resource with the provided ID was not found"
}'''

[[response]]
status = 422
description = '''Unprocessable Entity - Validation Errors'''
body = '''{
  "errors": "Validation errors",
  "invalid_attributes": {
    "name": ["already taken"]
  }
}'''
[/responses]

#### Example cURL

```shell
[label Example]
curl --request PATCH \
  --url https://errors.betterstack.com/api/v1/applications/1234 \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "updated-web-app",
    "ingesting_paused": false,
    "code_mapping_stack_root": "/usr/src/app/",
    "code_mapping_source_root": "apps/backend/"
  }'
```
