Create an application

Creates a new error tracking application.

POST https://errors.betterstack.com/api/v3/applications

Headers

Authorization
required string
Content-Type
required string

Body parameters

team_name
string
name
required string
platform
required string
data_region
string
errors_retention
integer
web_events_retention
integer
replays_retention
integer
application_group_id
string
correlate_with_source_id
string
github_repository_name
string
code_mapping_stack_root
string
code_mapping_source_root
string
vrl_transformation_exceptions
string
vrl_transformation_replays
string
vrl_transformation_web_events
string
vrl_transformation_logs
string
vrl_transformation_spans
string
spike_protection_baseline_multiplier
integer or null
ai_prompt_template
string or null
js_tag_configuration
object
js_tag_configuration.collect
object
js_tag_configuration.collect.errors
boolean
js_tag_configuration.collect.web_vitals
boolean
js_tag_configuration.collect.console
boolean
js_tag_configuration.collect.memory
boolean
js_tag_configuration.collect.analytics
boolean
js_tag_configuration.collect.anonymous_events
boolean
js_tag_configuration.collect.replays
boolean
js_tag_configuration.collect.identified_events
boolean
js_tag_configuration.collect.fingerprint
boolean
js_tag_configuration.sampling
object
js_tag_configuration.sampling.errors
integer
js_tag_configuration.sampling.replays
integer
js_tag_configuration.sampling.web_events
integer
js_tag_configuration.exclude_selectors
array of strings
js_tag_configuration.mask_selectors
array of strings
js_tag_configuration.shared_session_domains
array of strings
js_tag_configuration.accept_incoming_sessions
boolean
js_tag_configuration.decorate_forms
boolean
js_tag_configuration.custom_config
string or null
js_tag_configuration.session_timeout_minutes
integer
js_tag_configuration.events_batch_interval_seconds
integer
js_tag_configuration.own_domain
string or null
201

Response body

{
  "data": {
    "id": "1234",
    "type": "application",
    "attributes": {
      "application_group_id": null,
      "correlate_with_source_id": 9876,
      "github_repository_name": "better-stack/my-app",
      "team_id": "t123456",
      "team_name": "example-team",
      "name": "new-web-app",
      "platform": "ruby_errors",
      "table_name": "new_web_app",
      "token": "abc123def456ghi789",
      "js_tag_token": "pMq7kR3nXwT9bY2sF6hJ4dLc",
      "ingesting_paused": false,
      "ingesting_host": "s1234.us-east-9.betterstackdata.com",
      "created_at": "2025-01-15T10:30:00.000Z",
      "updated_at": "2025-01-15T10:30:00.000Z",
      "errors_retention": 90,
      "web_events_retention": 30,
      "replays_retention": 30,
      "data_region": "us-east-9",
      "custom_bucket": null,
      "code_mapping_stack_root": "/usr/src/app/",
      "code_mapping_source_root": "apps/backend/",
      "vrl_transformation_exceptions": "._pattern = slice!(sha2(to_string!(.summary.type)), 0, 24)\n.",
      "vrl_transformation_replays": "",
      "vrl_transformation_web_events": ".payload.meta.path = parse_url!(.payload.meta.url).path\n.",
      "vrl_transformation_logs": "",
      "vrl_transformation_spans": "",
      "spike_protection_baseline_multiplier": 10,
      "ai_prompt_template": "Fix this {{type}} in {{file}}: {{message}}\n\n{{stack_trace}}",
      "js_tag_configuration": {
        "collect": {
          "errors": true,
          "web_vitals": true,
          "console": true,
          "memory": true,
          "analytics": true,
          "anonymous_events": true,
          "replays": true,
          "identified_events": true,
          "fingerprint": true
        },
        "sampling": {
          "errors": 100,
          "replays": 100,
          "web_events": 100
        },
        "exclude_selectors": [
          "input",
          "textarea",
          "select"
        ],
        "mask_selectors": [],
        "shared_session_domains": [],
        "accept_incoming_sessions": true,
        "decorate_forms": false,
        "custom_config": null,
        "session_timeout_minutes": 30,
        "events_batch_interval_seconds": 2,
        "own_domain": null
      },
      "js_tag_own_domain_status": null
    }
  }
}
401

Response body

{
  "errors": "Invalid authentication"
}
400

Response body

{
  "errors": "Sorry, you are missing some required attributes",
  "required_attributes": [
    "name",
    "platform"
  ]
}
422

Response body

{
  "errors": [
    "platform must be suffixed with \"_errors\" for Errors applications"
  ],
  "invalid_attributes": [
    "platform"
  ]
}
422

Response body

{
  "errors": {
    "github_repository_name": [
      "GitHub repository 'owner/repo' isn't connected to this team. Connect it first at https://errors.betterstack.com/team/t123/integrations/github/edit"
    ]
  }
}

Example cURL

Example
curl --request POST \
  --url https://errors.betterstack.com/api/v3/applications \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "new-web-app",
    "platform": "ruby_errors",
    "errors_retention": 90,
    "data_region": "us-east-9",
    "correlate_with_source_id": "9876",
    "github_repository_name": "better-stack/my-app",
    "code_mapping_stack_root": "/usr/src/app/",
    "code_mapping_source_root": "apps/backend/",
    "spike_protection_baseline_multiplier": 10,
    "ai_prompt_template": "Fix this {{type}} in {{file}}: {{message}}\n\n{{stack_trace}}"
  }'