Attach a network to a MySQL instance
Attach one of your networks to every member of an instance. The network must be in the instance's team. The members join it in the background.
The ID of the MySQL instance to attach.
Bearer $TOKEN
application/json
The ID of the network to attach.
{
"id": "example",
"name": "Example MySQL instance",
"type": "MY1",
"usable_disk_gb": 1,
"max_connections": 1,
"engine_version": "1.4.2",
"engine_patch_version": "1.4.2",
"available_engine_versions": [
"1.4.2"
],
"status": "provisioning",
"status_message": "example",
"sql_mode": "example",
"sql_require_primary_key": false,
"default_time_zone": "UTC",
"max_allowed_packet": 67108864,
"public_access": false,
"replica_count": 0,
"read_only": false,
"endpoint": {
"hostname": "proxy.example.com",
"public_hostname": "proxy.example.com",
"port": 443,
"private_ips": [
{
"network_id": "123456789",
"ip_address": "example"
}
],
"public_ips": [
{
"ip": "example",
"type": "example"
}
]
},
"members": [
{
"id": "example",
"role": "primary",
"status": "provisioning",
"replication_lag_seconds": 1.5,
"disk_used_bytes": 1,
"private_ips": [
{
"network_id": "123456789",
"ip_address": "example"
}
],
"created_at": "2026-07-01T12:00:00.000Z"
}
],
"network_ids": [
"123456789"
],
"firewall_ids": [
"123456789"
],
"latest_snapshot_at": "2026-07-01T12:00:00.000Z",
"term": "monthly",
"created_at": "2026-07-01T12:00:00.000Z",
"updated_at": "2026-07-01T12:00:00.000Z",
"team_id": "t123",
"metadata": {
"example": "value"
}
}
{
"error": {
"message": "Malformed JSON body.",
"code": "bad_request"
}
}
{
"error": {
"message": "Missing or invalid token.",
"code": "unauthorized"
}
}
{
"error": {
"message": "We require at least one successful credit card transaction before allowing billable actions via the API. This significantly helps us to prevent fraud. Once your first transaction is processed, you will be able to use the API unrestricted. Please add credit to your account at https://betterstack.com/settings/billing/card/new?credits=10&activate_api=true. Need help? We're here for you at hello@betterstack.com.",
"code": "payment_required"
}
}
{
"error": {
"message": "This token is read-only and cannot be used for write operations.",
"code": "read_only_token"
}
}
{
"error": {
"message": "Resource not found.",
"code": "not_found"
}
}
{
"error": {
"message": "The request could not be completed right now. Please try again in a few moments.",
"code": "internal_error"
}
}
Returns the MySQL instance.
The body isn't valid JSON.
The API token is missing or invalid.
The organization hasn't made its first payment yet, and the request creates a resource we charge for. The code is payment_required. A request that creates a server, load balancer, object cache, database, reserved IP or volume can also return first_purchase. The url in first_purchase opens a page where you make the payment. The resource is created after the payment. The page works until expires_at, 24 hours after the response.
The request would go over a quota, with the code quota_exceeded. Or a read-only token tried to make a change, with the code read_only_token. Or a rule of the resource forbids it.
The resource doesn't exist, it's in another zone, or your token can't access it.
The resource's state doesn't allow the request, such as starting a running server or removing a placement group that still has servers.
A value isn't valid, with the code validation_failed. The error's details list the messages for each field. A create or rescale that names a deprecated type with a replacement returns the code type_deprecated. The error's details then name the field, the deprecated type and its replacement.
We've locked the resource, with the code locked. Every change to a locked resource is refused, and so is a change that involves one.
Too many requests, with the code rate_limited. We limit requests per client IP and per organization, and some costly endpoints have a stricter limit. Wait as long as the Retry-After header says.
An unexpected, temporary error on our side, with the code internal_error. Try again.
The zone has no capacity, with the code no_capacity. Or we couldn't set up or change the resource, with the code orchestration_failed. Or the organization is creating too many resources at the same time, with the code concurrent_create_limit. Try again after a short wait.
The instance's ID, a UUID.
The instance's name, at most 255 characters.
The instance's type, such as MY1. List the types with betterstack mysql-type list.
The disk space for your data, in GiB.
The most connections the instance accepts at once.
The MySQL version, as major and minor, such as 9.7. List the versions with betterstack mysql-version list.
The exact MySQL release installed, or null until it's known.
The versions you can upgrade the instance to. An upgrade can't be undone.
The instance's state.
Valid values:provisioning: We're starting the members and installing MySQL.running: The instance is ready.degraded: A member is down, replication is broken or the disk is almost full. status_message says which.rescaling: We're changing the instance's type.upgrading: We're upgrading the instance to a newer MySQL version.restoring: We're restoring the instance from a snapshot.failed: We couldn't create the instance. status_message says why. Create a new one instead.destroyed: The instance is destroyed.
Why the instance is in its current state, such as what failed or which operation didn't finish. Is null when there's nothing to report.
The SQL modes, separated by commas, such as STRICT_TRANS_TABLES,NO_ZERO_DATE. Is null for MySQL's default modes.
Whether new tables must have a primary key.
The default time zone. Accepts SYSTEM, UTC, an offset from -13:59 to +14:00, or an IANA time zone name such as Europe/Prague.
The largest packet MySQL accepts, in bytes, from 16777216 to 1073741824.
Whether the instance is also reachable on public IP addresses. Clients must connect with TLS.
The number of read replicas, from 0 to 2.
Whether the instance accepts only reads because its disk is almost full.
Where clients connect to the current primary.
The hostname to connect to from your networks. Resolves to the primary's addresses in your networks.
The hostname to connect to from the internet, or null when public_access is off. Resolves to the primary's public addresses.
The port to connect to, 3306.
The primary's addresses in your networks.
The ID of the network.
The address in that network.
The primary's public addresses, empty when public_access is off.
The public address.
Whether it's an ipv4 or ipv6 address.
The instance's members, the primary and its replicas. A replica's replication_lag_seconds says how far behind the primary it is, and it's null on the primary.
The id.
Possible values: primary, replica.
Possible values: provisioning, syncing, running, down.
The replication lag seconds.
The disk used bytes.
The private ips.
The network id.
The ip address.
In ISO 8601 format, such as 2026-07-01T12:00:00Z.
The IDs of your networks attached to every member. Order doesn't matter.
The ID of the firewall attached to every member. An instance can have one firewall. Order doesn't matter.
When the newest available snapshot was taken, or null when there's none. In ISO 8601 format, such as 2026-07-01T12:00:00Z.
The billing term. Defaults to monthly.
Valid values:monthly: Billed every month.annual: Paid for a year.
When the instance was created. In ISO 8601 format, such as 2026-07-01T12:00:00Z.
When the instance was last updated. In ISO 8601 format, such as 2026-07-01T12:00:00Z.
The ID of the team that owns the instance. betterstack team list shows it.
Your tags, as an object of string keys and values.