Introduction🔗
Documentation for ElephantSQL API.
Backups🔗
List backups🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
https://api.elephantsql.com/api/backup?db=my-db
The above command returns JSON structured like this:
[
{
"id":7,
"database_id":"5abb0624-909b-4e79-aa7a-f488dcae752b",
"backup_date":"2017-05-15 15:03:14+0200",
"size":2221,
"bucket":null,
"file_name":"nutty-jackfruit/tyicyjck.2017-05-15.sql.lzo",
"region":"amazon-web-services::us-east-1",
"database_name":"tyicyjck",
"url":"https://elephantsql-backups-us-east-1.s3.amazonaws.com/nutty-jackfruit/tyicyjck.2017-05-15.sql.lzo?AWSAccessKeyId=AKIAIDFGDFGEDIGRVQ&Expires=1494865612&Signature=t3Hi7iKASDB%vfBlAjPLgTYsaQ%3D"
}
]
List backups for last 30 days, ordered with the most recent first.
HTTP Request🔗
GET https://api.elephantsql.com/api/backup
Request Parameters🔗
| Parameter | Description |
|---|---|
| db | Name of the database (optional) |
Create backup🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "db=my-db" \
https://api.elephantsql.com/api/backup
HTTP Request🔗
POST https://api.elephantsql.com/api/backup
Request Parameters🔗
| Parameter | Description |
|---|---|
| db | Name of the database (optional) |
| callback | JSON endpoint to POST to when backup is ready (optional) |
Restore backup🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "backup_id=1234" \
https://api.elephantsql.com/api/backup/restore
The optional callback gets a request with this body
{
"action": "restore",
"backup_id": 4,
"account_id": "5abb0624-909b-4e79-aa7a-f488dcae752b"
}
HTTP Request🔗
POST https://api.elephantsql.com/api/backup/restore
Request Parameters🔗
| Parameter | Description |
|---|---|
| backup_id | The id of the backup to restore |
| callback | JSON endpoint to POST to when database is restored |
Point in time recovery🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "pit=2018-01-01%2000%3A00" \
https://api.elephantsql.com/api/backup/pitr
The optional callback gets a request with this body
{
"action": "pitr",
"account_id": "5abb0624-909b-4e79-aa7a-f488dcae752b"
}
HTTP Request🔗
POST https://api.elephantsql.com/api/backup/pitr
Request Parameters🔗
| Parameter | Description |
|---|---|
| pit | Time to recover to (yyyy-mm-dd hh:mm) |
| callback | JSON endpoint to POST to when database is restored |
Account🔗
Rotate password🔗
Initiate rotation of the user password on your instance.
curl -XPOST -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx \
https://api.elephantsql.com/api/account/rotate-password
HTTP Request🔗
POST https://api.elephantsql.com/api/account/rotate-password
Rotate API key🔗
curl -XPOST -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx \
https://api.elephantsql.com/api/account/rotate-apikey
HTTP Request🔗
POST https://api.elephantsql.com/api/account/rotate-apikey
Alarms🔗
Information about both alarms, notifications and recipient. When creating a new instace, a set of default alarms and recipient will be created.
Recipient: There will always be a default recipient created, using the team email set during sign up. This recipient is used to receive notifications from the default alarms.
Alarm: There will always be four default alarms created, cpu, memory, disk and notice alarms.
Create recipient🔗
To use another recipient than default recipient, a new one needs to be created.
Available recipients types:
- email Send an email notification
- webhook Send a webhook notification
- pagerduty Send a notification to PagerDuty
- opsgenie, opsgenie-eu, victorops Send a notificaiton to opsgenie, opsgenie-eu or victotops
- slack Send a notification to Slack channels using Incoming Webhooks
- teams Send a notification to Microsoft Teams channels using Incoming Webhooks
HTTP Request🔗
POST https://api.elephantsql.com/api/alarms/recipients
Example of email recipient🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "type=email&value=notification@example.com&name=low" \
https://api.elephantsql.com/api/alarms/recipients
This creates an email recipient for notification@example.com that can be used to receive alarm notifications. The returned JSON structured look like this:
{
"id": 2,
"type": "email",
"value": "notification@example.com",
"name": "Low",
"options": {}
}
Request body parameters🔗
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | true | string | The type of notification to be sent |
| value | true | string | Endpoint to where the notification will be sent |
| name | false | string | Optional, name for the recipient |
List recipients🔗
Retrieve all recipients for an instance that can receive notifications
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
https://api.elephantsql.com/api/alarms/recipients
The above command returns JSON structured like this:
[
{
"id": 1,
"type": "email",
"value": "team@84codes.com",
"name": "Default",
"options": null
},
{
"id": 2,
"type": "email",
"value": "notification@example.com",
"name": "Low",
"options": null
}
]
HTTP Request🔗
GET https://api.elephantsql.com/api/alarms/recipients
Retrieve specific recipient🔗
Use the id of a recipient to retrieve it
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
https://api.elephantsql.com/api/alarms/recipients/1
The above command returns JSON structured like this:
{
"id": 1,
"type": "email",
"value": "team@example.com",
"name": "Default",
"options": null
}
HTTP Request🔗
GET https://api.elephantsql.com/api/alarms/recipients/<id>
Update recipient🔗
Update a specific recipient with new information
HTTP Request🔗
PUT https://api.elephantsql.com/api/alarms/recipients/<id>
Example of email recipient🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "type=email&value=alarms@example.com&name=High" \
https://api.elephantsql.com/api/alarms/recipients/2
This updates an email recipient for notification@example.com that can be used to receive alarm notifications. The returned JSON structured look like this:
{
"id": 2,
"type": "email",
"value": "alarm@example.com",
"name": "High",
"options": {},
}
URL Parameters🔗
| Parameter | Description |
|---|---|
| id | The recipient identifier |
Request body parameters🔗
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | true | string | The type of notification to be sent |
| value | true | string | Endpoint to where the notification will be sent |
| name | false | string | Optional, name for the recipient |
Delete recipient🔗
Use the id of a specific recipient to remove it
curl -XDELETE -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
https://api.elephantsql.com/api/alarms/recipients/2
HTTP Request🔗
DELETE https://api.elephantsql.com/api/alarms/recipients/<id>
URL Parameters🔗
| Parameter | Description |
|---|---|
| id | Use the id of the recipient that you want to delete |
Create alarm🔗
Available alarms types:
| Name | Type | Dedicated | Shared | Description |
|---|---|---|---|---|
| CPU | cpu | yes | - | Alarm if CPU usage is above a certain level for a period of time |
| Memory | memory | yes | - | Alarm if memory usage is above a certain level for a period of time |
| Disk space | disk | yes | - | Alarm id disk usage is above a certain level for a period of time |
| Net split | netsplit | yes | - | Alarm if net split occurs |
| Server unreachable | server_unreachable | yes | - | Alarm if server is unreachable |
| Notice | notice | yes | yes | Notifications on events such as planned or emergency maintenance |
HTTP Request🔗
POST https://api.elephantsql.com/api/alarms
Request (CPU alarm)🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "type=cpu&enabled=true&value_threshold=90&time_threshold=600&recipients=[1]" \
https://api.elephantsql.com/api/alarms
This sets the alarm to trigger if the CPU usage is above 90% for 10 minutes or more.
{
"type": "cpu",
"enabled": true,
"value_threshold": 90,
"time_threshold": 600,
"recipients": [1]
}
| Parameter | Type | Description |
|---|---|---|
| type | string | The alarm type, valid types see table Available alarms types above |
| enabled | bool | Enable or disable the alarm |
| value_threshold | int | The value threshold to trigger the alarm |
| time_threshold | int | For how long (in seconds) the value_threshold should be active before trigger alarm |
| recipients | []int | Recipients identifiers for which should receive notifications when the alarm trigger |
Request (Memory alarm)🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "type=memory&enabled=true&value_threshold=90&time_threshold=600&recipients=[1]" \
https://api.elephantsql.com/api/alarms
This sets the alarm to trigger if the memory usage is above 90% for 10 minutes or more.
{
"type": "memory",
"enabled": true,
"value_threshold": 90,
"time_threshold": 600,
"recipients": [1]
}
| Parameter | Type | Description |
|---|---|---|
| type | string | The alarm type, valid types see table Available alarms types above |
| enabled | bool | Enable or disable the alarm |
| value_threshold | int | The value threshold to trigger the alarm |
| time_threshold | int | For how long (in seconds) the value_threshold should be active before trigger alarm |
| recipients | []int | Recipients identifiers for which should receive notifications when the alarm trigger |
Request (Disk space alarm)🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "type=disk&enabled=true&value_threshold=5&time_threshold=600&recipients=[1]" \
https://api.elephantsql.com/api/alarms
This sets the alarm to trigger if available disk space is above 5Gb for 10 minutes or more.
{
"type": "cpu",
"enabled": true,
"value_threshold": 5,
"time_threshold": 600,
"recipients": [1]
}
| Parameter | Type | Description |
|---|---|---|
| type | string | The alarm type, valid types see table Available alarms types above |
| enabled | bool | Enable or disable the alarm |
| value_threshold | int | The value threshold to trigger the alarm (unit is gigabytes if calculation fixed) |
| value_calculation | string | How to treat value threshold, possible values: fixed (default), percentage
|
| time_threshold | int | For how long (in seconds) the value_threshold should be active before trigger alarm |
| recipients | []int | Recipients identifiers for which should receive notifications when the alarm trigger |
Request (Notice)🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "type=notice&enabled=true&recipients=[1]" \
https://api.elephantsql.com/api/alarms
Notifies recipients on events such as planned or emergency maintenance
{
"type": "notice",
"enabled": true,
"recipients": [1]
}
| Parameter | Type | Description |
|---|---|---|
| type | string | The alarm type, valid types see table Available alarms types above |
| enabled | bool | Enable or disable the alarm |
| recipients | []int | Recipients identifiers for which should receive notifications when the alarm trigger |
Request (Server unreachable)🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "type=server_unreachable&enabled=true&recipients=[1]" \
https://api.elephantsql.com/api/alarms
Notifies recipients if the server is unreachable
{
"type": "server_unreachable",
"enabled": true,
"recipients": [1]
}
| Parameter | Type | Description |
|---|---|---|
| type | string | The alarm type, valid types see table Available alarms types above |
| enabled | bool | Enable or disable the alarm |
| recipients | []int | Recipients identifiers for which should receive notifications when the alarm trigger |
List alarms🔗
Retrive all alarms used for the instance.
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
https://api.elephantsql.com/api/alarms
Example of the default created alarms:
[
{
"time_threshold": 600,
"value_threshold": 90,
"id": 7395,
"type": "cpu",
"recipients": [],
"enabled": true
},
{
"time_threshold": 600,
"value_threshold": 90,
"id": 7396,
"type": "memory",
"recipients": [],
"enabled": true
},
{
"time_threshold": 600,
"value_threshold": 5,
"id": 7397,
"type": "disk",
"recipients": [],
"enabled": true
},
{
"id": 7398,
"type": "notice",
"recipients": [],
"enabled": true
}
]
HTTP Request🔗
GET https://api.elephantsql.com/api/alarms
Retrieve specific alarm🔗
Use the id of a specific alarm to retrieve it.
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
https://api.elephantsql.com/api/alarms/7395
The above command returns JSON structured like this:
{
"time_threshold": 600,
"value_threshold": 90,
"id": 7395,
"type": "cpu",
"recipients": [1],
"enabled": true
}
HTTP Request🔗
GET https://api.elephantsql.com/api/alarms/<id>
Update alarm🔗
Use the id of a specific alarm to update it
HTTP Request🔗
PUT https://api.elephantsql.com/api/alarms/<id>
Request Parameters (CPU alarm)🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "type=cpu&enabled=true&value_threshold=90&time_threshold=600&recipients=[1]" \
https://api.elephantsql.com/api/alarms
This sets the alarm to trigger if the CPU usage is above 90% for 10 minutes or more.
| Parameter | Type | Description |
|---|---|---|
| type | string | The alarm type, valid types see table Available alarms types above |
| enabled | bool | Enable or disable the alarm |
| value_threshold | int | The value threshold to trigger the alarm |
| time_threshold | int | For how long (in seconds) the value_threshold should be active before trigger alarm |
| recipients | []int | Recipients identifiers for which should receive notifications when the alarm trigger |
For more examples, see under the section about creating alarm.
Delete alarm🔗
Use the id for a specific alarm to remove it.
curl -XDELETE -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
https://api.elephantsql.com/api/alarms/7395
HTTP Request🔗
DELETE https://api.elephantsql.com/api/alarms/<id>
URL Parameters🔗
| Parameter | Description |
|---|---|
| id | Use the id of the alarm that you want to delete |
Integrations🔗
List log integrations🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
https://api.elephantsql.com/api/integrations/logs
The above command returns JSON structured like this:
[
{
"id":10,
"type":"papertrail",
"config": {
"url":"logs.papertrail.com:2123"
},
"error": "",
"account_id": "99ed6d99-fjsd-7d7d-8ujd-2f53asf34weaws"
}
]
HTTP Request🔗
GET https://api.elephantsql.com/api/integrations/logs
Add log integration🔗
Available log integrations are:
- Azure monitor
- CloudWatch Logs
- Coralogix
- Datadog
- Logentries
- Loggly
- Papertrail
- Scalyr
- Splunk
HTTP Request🔗
POST https://api.elephantsql.com/api/integrations/logs/<SYSTEM>
URL Parameters🔗
| Parameter | Description |
|---|---|
| SYSTEM | The logs system to integrate to, any of these: azure_monitor, cloudwatchlog, coralogix, datadog, logentries, loggly, papertrail, scalyr or splunk
|
Request Parameters (azure_monitor)🔗
Use Azure portal to configure external access for Azure monitor. Tutorial to find/create all params below.
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "tenant_id=CHANGEM&application_id=CHANGEME&application_secret=CHANGEME&dce_uri=CHANGEME&table=CHANGEME&dcr_id=CHANGEME" \
https://api.elephantsql.com/api/integrations/logs/azure_monitor
| Parameter | Description |
|---|---|
| tenant_id | Directory (tenant) ID. |
| application_id | Application (client) ID. How to create an application |
| application_secret | Application secret |
| dce_uri | Data Collection Endpoint URI. How to create a DCE |
| table | Table name. Table should have the columns: TimeGenerated, Host, Event, Level and Message. How to create a table |
| dcr_id | ID of Data Collection Rule that your DCE is linked to. Find the DCR ID |
Request Parameters (cloudwatchlog)🔗
Need to create an IAM user with programmatic permissions:
- CreateLogGroup
- CreateLogStream
- DescribeLogGroups
- DescribeLogStreams
- PutLogEvents
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "region=us-west-1&access_key_id=87656789&secret_access_key=09876tyui9876yui98" \
https://api.elephantsql.com/api/integrations/logs/cloudwatchlog
| Parameter | Description |
|---|---|
| region | The AWS region to use |
| access_key_id | The access key id to use |
| secret_access_key | The secret that goes with the key id |
Request Parameters (coralogix)🔗
Create a 'Send-Your-Data' private API key, Coralogix documentation
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "private_key=CHANGEM&endpoint=CHANGEME&application=CHANGEME&subsystem=CHANGEME" \
https://api.elephantsql.com/api/integrations/logs/coralogix
| Parameter | Description |
|---|---|
| private_key | The API key used for authentication |
| endpoint | The syslog destination to send the logs to (e.g. syslog.eu2.coralogix.com:6514) |
| application | The "Application Name", see Coralogix documentation |
| subsystem | The "Subsystem Name", see Coralogix documentation |
Request Parameters (datadog)🔗
Create a Datadog API key at app.datadoghq.com
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "api_key=XXXXXXXXXXXXX®ion=us1&tags=env=dev,region=europe" \
https://api.elephantsql.com/api/integrations/logs/datadog
| Parameter | Description |
|---|---|
| api_key | The API key ised for authentication |
| region | The region to send the logs, [us1, us3, us5, eu] |
| tags | (Optional) Enter tags for the integration, like this: env=prod,region=europe |
If tags are used, the value part (prod, europe) must start with a letter. Read more about tags format in the Datadog documentation
Request Parameters (logentries)🔗
Create a Logentries token at logentries add-log
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "token=XXXXXXXXXXXXX" \
https://api.elephantsql.com/api/integrations/logs/logentries
| Parameter | Description |
|---|---|
| token | A TCP token for authentication |
Request Parameters (loggly)🔗
Create a Loggly token at https://{your-company}.loggly.com/tokens
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "token=XXXXXXXXX" \
https://api.elephantsql.com/api/integrations/logs/loggly
| Parameter | Description |
|---|---|
| token | The token used for authentication |
Request Parameters (papertrail)🔗
Create a Papertrail endpoint at papertrail setup
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "url=logs.papertrail.com:2123" \
https://api.elephantsql.com/api/integrations/logs/papertrail
| Parameter | Description |
|---|---|
| url | The URL to push the logs to |
Request Parameters (scalyr)🔗
Create a Log write token at Scalyr keys
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "token=XXXXX&host=app.scalyr.com" \
https://api.elephantsql.com/api/integrations/logs/scalyr
| Parameter | Description |
|---|---|
| token | The token used for authentication |
| host | Destination to send the logs [app.scalyr.com, app.eu.scalyr.com] |
Request Parameters (splunk)🔗
Create a HTTP Event Collector token at https://<your-splunk>.cloud.splunk.com/en-US/manager/search/http-eventcollector
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "token=XXXXX&host_port=innput-prd-p-rdq96mdbptj4.cloud.splunk.com:8080&sourcetype=generic_single_line" \
https://api.elephantsql.com/api/integrations/logs/splunk
| Parameter | Description |
|---|---|
| token | The token used for authentication |
| host_port | Destination to send the logs |
| sourcetype | Assigns source type to the data exported |
Update log integration🔗
curl -XPUT -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "api_key=XXXXXXXXXXXXX®ion=us1&tags=env=dev" \
https://api.elephantsql.com/api/integrations/logs/datadog/11
HTTP Request🔗
PUT https://api.elephantsql.com/api/integrations/logs/<INT_ID>
URL Parameters🔗
| Parameter | Description |
|---|---|
| INT_ID | The ID of the integration to update |
Request Parameter🔗
See above supported systems and paramaters
Delete log integration🔗
curl -XDELETE -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
https://api.elephantsql.com/api/integrations/logs/636
HTTP Request🔗
DELETE https://api.elephantsql.com/api/integrations/logs/<INT_ID>
URL Parameters🔗
| Parameter | Description |
|---|---|
| INT_ID | The ID of the integration to delete |
List metrics integrations🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
https://api.elephantsql.com/api/integrations/metrics
The above command returns JSON structured like this:
[
{
"id":10,
"type":"datadog",
"config": {
"api_key":"XXXXXXXXXXXXX",
"region": "us1",
"tags": "env=dev"
},
"error": "",
"account_id": "99ed6d99-fjsd-7d7d-8ujd-2f53asf34weaws"
}
]
HTTP Request🔗
GET https://api.elephantsql.com/api/integrations/metrics
Add metrics integration🔗
Available metrics integrations are:
| Name | RabbitMQ version < 4.2 | RabbitMQ version >= 4.2 | LavinMQ |
|---|---|---|---|
| CloudWatch | yes | - | yes |
| CloudWatch v2 | yes | - | yes |
| CloudWatch v3 | - | yes | yes |
| Datadog | yes | - | yes |
| Datadog v2 | yes | - | yes |
| Datadog v3 | - | yes | yes |
| Librato | yes | - | yes |
| NewRelic v2 | yes | - | yes |
| NewRelic v3 | - | yes | yes |
| Splunk | yes | - | yes |
| Stackdriver | yes | - | yes |
| Stackdriver v2 | - | yes | yes |
HTTP Request🔗
POST https://api.elephantsql.com/api/integrations/metrics/<SYSTEM>
URL Parameters🔗
| Parameter | Description |
|---|---|
| SYSTEM | The metrics system to integrate to , any of these: cloudwatch, cloudwatch_v2, cloudwatch_v3, librato, datadog, datadog_v2, datadog_v3, newrelic_v2, newrelic_v3, or splunk
|
Request Parameters (cloudwatch and cloudwatch_v2) with access keys🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "region=us-west-1&access_key_id=87656789&secret_access_key=09876tyui9876yui98" \
https://api.elephantsql.com/api/integrations/metrics/cloudwatch
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "region=us-west-1&access_key_id=87656789&secret_access_key=09876tyui9876yui98" \
https://api.elephantsql.com/api/integrations/metrics/cloudwatch_v2
| Parameter | Description |
|---|---|
| region | The AWS region to use |
| access_key_id | The access key id to use (Needs to have the PutMetricData permission) |
| secret_access_key | The secret that goes with the key id |
Request Parameters (cloudwatch, cloudwatch_v2 and cloudwatch_v3) with assume role🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "region=us-west-1&iam_role=arn:aws:iam::ACCOUNT-ID:role/ROLE-NAME&iam_external_id=cloudamqp-abc123" \
https://api.elephantsql.com/api/integrations/metrics/cloudwatch
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "region=us-west-1&iam_role=arn:aws:iam::ACCOUNT-ID:role/ROLE-NAME&iam_external_id=cloudamqp-abc123" \
https://api.elephantsql.com/api/integrations/metrics/cloudwatch_v2
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "region=us-west-1&iam_role=arn:aws:iam::ACCOUNT-ID:role/ROLE-NAME&iam_external_id=cloudamqp-abc123" \
https://api.elephantsql.com/api/integrations/metrics/cloudwatch_v3
| Parameter | Description |
|---|---|
| region | The AWS region to use |
| iam_role | An AWS IAM role in your account with PutMetricData permission. |
| iam_external_id | Create own external identifier that match the role created. E.g. "cloudamqp-abc123". |
Request Parameters (librato)🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "email=my@email.com&api_key=9876thjio90876tyu" \
https://api.elephantsql.com/api/integrations/metrics/librato
| Parameter | Description |
|---|---|
| The email registered at librato | |
| api_key | The API key |
Request Parameters (datadog, datadog_v2 and datadog_v3)🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "api_key=XXXXXXXXXXXXX®ion=us1" \
https://api.elephantsql.com/api/integrations/metrics/datadog
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "api_key=XXXXXXXXXXXXX®ion=us1" \
https://api.elephantsql.com/api/integrations/metrics/datadog_v2
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "api_key=XXXXXXXXXXXXX®ion=us1" \
https://api.elephantsql.com/api/integrations/metrics/datadog_v3
| Parameter | Description |
|---|---|
| api_key | The API key |
| region | The region to send the logs, [us1, us3, us5, eu] |
Request Parameters (newrelic_v2 and newrelic_v3)🔗
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "license_key=XXXXXXXXXXXXXXXXX" \
https://api.elephantsql.com/api/integrations/metrics/newrelic_v2
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "license_key=XXXXXXXXXXXXXXXXX" \
https://api.elephantsql.com/api/integrations/metrics/newrelic_v3
| Parameter | Description |
|---|---|
| license_key | The license key for NewRelic |
Request Parameters (splunk)🔗
Create a HTTP Event Collector token at https://<your-splunk>.cloud.splunk.com/en-US/manager/search/http-eventcollector
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "token=XXXXX&host_port=innput-prd-p-rdq96mdbptj4.cloud.splunk.com:8080&sourcetype=generic_single_line" \
https://api.elephantsql.com/api/integrations/metrics/splunk
| Parameter | Description |
|---|---|
| token | The token used for authentication |
| host_port | Destination to send the logs |
| sourcetype | Assigns source type to the data exported |
Optional Request Parameter🔗
Request paramater that are optional and can be added to each metric integration.
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "region=us-west-1&access_key_id=87656789&secret_access_key=09876tyui9876yui98&tags=env=prod,region=europe" \
https://api.elephantsql.com/api/integrations/metrics/cloudwatch_v2
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "api_key=XXXXXXXXXXXXX®ion=us1&tags=env=prod,region=europe" \
https://api.elephantsql.com/api/integrations/metrics/datadog_v2
| Parameter | Description |
|---|---|
| tags | Enter tags for the integration, like this: env=prod,region=europe |
| queue_regex | Allowlist to filter queues using regular expression. Leave empty to include all queues. |
| vhost_regex | Allowlist to filter vhost using regular expression. Leave empty to include all queues. |
| include_ad_queues | Â true/false By default we don't include auto-delete queues in the metrics. |
Update metrics integration🔗
curl -XPUT -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d "api_key=XXXXXXXXXXXXX®ion=us1&tags=env=dev,region=us1" \
https://api.elephantsql.com/api/integrations/metrics/10
HTTP Request🔗
PUT https://api.elephantsql.com/api/integrations/metrics/<INT_ID>
URL Parameters🔗
| Parameter | Description |
|---|---|
| INT_ID | The ID of the integration to update |
Request Parameter🔗
See above supported systems and paramaters
Delete metric integration🔗
curl -XDELETE -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
https://api.elephantsql.com/api/integrations/metrics/636
HTTP Request🔗
DELETE https://api.elephantsql.com/api/integrations/metrics/<INT_ID>
URL Parameters🔗
| Parameter | Description |
|---|---|
| INT_ID | The ID of the integration to delete |
Maintenance🔗
List, run and reschedule maintenance
List upcoming maintenance🔗
curl -XGET -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx https://api.elephantsql.com/api/maintenance
The above command returns JSON structured like this:
[
{
"id": 1234,
"scheduled_by": "2022-02-05 00:36:00 +0000",
"status": "scheduled",
"required_by": "2022-03-05 00:00:00 +0000",
"duration": "1 hour",
"description": "..."
}
]
HTTP Request🔗
GET https://api.elephantsql.com/api/maintenance
Reschedule maintenance🔗
curl -XPUT -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
-d '{"scheduled_by":"2022-02-05 00:36:00 +0000"}' \
-H "Content-type: application/json" \
https://api.elephantsql.com/api/maintenance/1234
HTTP Request🔗
PUT https://api.elephantsql.com/api/maintenance/<ID>
Request Parameters🔗
| Parameter | Description |
|---|---|
| scheduled_by | Date string |
URL Parameters🔗
| Parameter | Description |
|---|---|
| ID | Maintenance id |
Run maintenance now🔗
HTTP Request🔗
curl -XPOST -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx https://api.elephantsql.com/api/maintenance/<ID>
URL Parameters🔗
| Parameter | Description |
|---|---|
| ID | Maintenance id |
Authentication🔗
Authentication is done by sending your API key in the user or password field for Basic Auth.
curl -u :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx \
https://api.elephantsql.com/api/<endpoint>
You can find your API key on the details page for your instance.
Formats🔗
All API end points support form FormData and JSON in the request.
You need to format the request accordingly and if you send the request as JSON
be sure to add the content type header content-type: application/json otherwise the server won't be able to parse your request.
Status Codes🔗
| Status Code | Meaning |
|---|---|
| 200 | The request completed successfully. |
| 204 | The request completed successfully. |
| 400 | Bad Request -- Your request might be invalid. |
| 401 | Unauthorized -- Your API key is wrong. |
| 403 | Forbidden -- The resource requested is hidden for administrators only. |
| 404 | Not Found -- The specified resource could not be found. |
| 405 | Method Not Allowed -- You tried to access a resource with an invalid method. |
| 429 | Too Many Requests -- Rate limiting, you have requested too many resources in a given amount of time. |
| 500 | Internal Server Error -- We had a problem with our server. Try again later. |