# Update a source

Updates an existing source. Send only the parameters you wish to change (e.g. `name`&nbsp;)

[endpoint]
base_url = "https://telemetry.betterstack.com"
path = "/api/v1/sources/{source_id}"
method = "PATCH"

[[path_param]]
name = "id"
description = "ID of the source you want to update"
required = true
type = "string"

[[body_param]]
name = "name"
description = "Source name"
required = false
type = "string"

[[body_param]]
name = "ingesting_paused"
description = "Enable or disable ingesting for this source"
required = false
type = "boolean"

[[body_param]]
name = "source_group_id"
description = "The ID of the source group this source belongs to"
required = false
type = "integer"

[[body_param]]
name = "live_tail_pattern"
description = """
Live tail message format with columns wrapped in `{column}` brackets.  \nExample: `"PID: {message_json.pid} {level} {message}"`.  \nFor details, see [Live tail docs](https://betterstack.com/docs/logs/using-logtail/formatting-logs/#live-tail-message-format).
"""
required = false
type = "string"

[[body_param]]
name = "logs_retention"
description = "Data retention for logs in days. There might be additional charges for longer retention."
required = false
type = "integer"

[[body_param]]
name = "metrics_retention"
description = "Data retention for metrics in days. There might be additional charges for longer retention."
required = false
type = "integer"

[[body_param]]
name = "vrl_transformation"
description = "The VRL code that's used to transform events. Read more about [VRL transformations](https://betterstack.com/docs/logs/using-logtail/transforming-ingested-data/logs-vrl/)."
required = false
type = "string"

[[body_param]]
name = "scrape_urls"
description = "URLs to scrape by `prometheus_scrape` platform and similar."
required = false
type = "array"

[[body_param]]
name = "scrape_frequency_secs"
description = "How often to scrape the URLs for `prometheus_scrape` platform and similar. Permitted values are 15, 30, 60, 120 or 300."
required = false
type = "integer"

[[body_param]]
name = "scrape_request_headers"
description = "An array of request headers for `prometheus_scrape` platform and similar, with each object containing `name` and `value` fields."
required = false
type = "array"

[[body_param]]
name = "scrape_request_basic_auth_user"
description = "Basic auth username for `prometheus_scrape` platform and similar."
required = false
type = "string"

[[body_param]]
name = "scrape_request_basic_auth_password"
description = "Basic auth password for `prometheus_scrape` platform and similar."
required = false
type = "string"

[[body_param]]
name = "skip_ssl_verify"
description = "Whether to skip SSL/TLS certificate verification for `prometheus_scrape` platform and similar. Set to `true` to disable verification."
required = false
type = "boolean"
[/endpoint]

[responses]
[[response]]
status = 200
description = '''The source was updated'''
body = '''
{
    "id": "95",
    "type": "source",
    "attributes": {
        "team_id": 123,
        "team_name": "Test team",
        "name": "Nginx",
        "source_group_id": 572,
        "table_name": "nginx",
        "platform": "nginx",
        "token": "FczKcxEhjEDE58dBX7XaeX1q",
        "ingesting_host": "s95.eu-nbg-2.betterstackdata.com",
        "ingesting_paused": false,
        "logs_retention": 7,
        "metrics_retention": 14,
        "live_tail_pattern": "{level} {host} {nginx.status} {nginx.method} {nginx.host} {nginx.path} {nginx.client} {nginx.agent} {message}",
        "vrl_transformation": ".message = upcase!(.message)\n.",
        "custom_bucket": {
          "name": "storage-bucket",
          "endpoint": "https://s3.us-east-1.amazonaws.com/storage-bucket",
          "access_key_id": "AKIAIOSFODNN7EXAMPLE"
        },
        "created_at": "2021-05-27T12:30:41.695Z",
        "updated_at": "2021-06-11T14:00:50.756Z"
    }
}
'''

[[response]]
status = 404
description = '''Your team has no source with the given ID'''
body = '''{
    "errors": "Resource with provided ID was not found"
}'''

[[response]]
status = 422
description = '''Validation failed'''
body = '''{
    "errors": "Your plan doesn't support custom retention",
    "invalid_attributes": ["logs_retention", "metrics_retention"]
}'''
[/responses]

#### Example cURL 

```shell
[label Example]
curl --request PATCH \
  --url https://telemetry.betterstack.com/api/v1/sources/123 \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "My renamed HTTP source"
  }'
```
