Heroku primarily uses a REST API, but also supports GraphQL APIs. The key points are:
Heroku's main Platform API is a REST API. The documentation refers to it as the "platform API" and provides details on how to make REST requests to api.heroku.com endpoints.
Heroku also supports building and deploying GraphQL APIs. There are examples and tutorials showing how to create GraphQL APIs on Heroku using Node.js and other technologies.
The REST API is Heroku's core API for programmatically managing Heroku resources like apps, add-ons, etc. It uses JSON for data exchange and follows REST principles.
For GraphQL, Heroku provides the ability to host and run GraphQL servers, but this is more for developers building their own APIs on top of Heroku, rather than Heroku's core API itself.
There is no mention of SOAP APIs in the context of Heroku's official APIs.
In summary, while Heroku's primary API is REST-based, they also support developers building and deploying GraphQL APIs on their platform. The core Heroku Platform API uses REST, but GraphQL can be used for custom APIs built on Heroku.
Yes, the official Heroku API does have webhooks. Here are the key points about Heroku webhooks:
Heroku offers app webhooks that enable you to receive notifications when particular changes are made to your Heroku app.
You can subscribe to notifications for a wide variety of events, including:
You can subscribe to webhooks in several ways:
For example, using the CLI:
heroku webhooks:add -i api:release -l notify -u https://example.com/hooks -a your-app
Webhook notifications are sent as HTTP POST requests to a URL of your choosing. The webhook payload contains detailed information about the event that occurred.
Heroku is encouraging users to migrate from the older Deploy Hooks to the more powerful and secure app webhooks. Deploy Hooks will be sunset on February 17, 2023.
In summary, Heroku's official API offers a robust webhook system that allows you to subscribe to a wide range of events, providing real-time notifications about changes to your Heroku apps and resources.
Here are the key points about the API rate limits for the Heroku API:
The Heroku API has a rate limit of 4500 calls per hour per account [2][4].
This limit applies across an entire account, not per application [4].
The rate limit resets hourly [4].
When the limit is exceeded, further API calls are blocked until the next hour when the limit resets [4].
Each account has a pool of 4500 request tokens [5].
Each API call uses one token from the pool [5].
Tokens are replenished at a rate of about 75 per minute (4500 per hour) up to the 4500 maximum [5].
If no tokens remain, further calls return a 429 Too Many Requests error until more tokens become available [5].
Implement rate limiting/throttling in your own code when making API calls [3].
Cache data where possible to reduce API calls [4].
Batch operations to minimize API requests [4].
Be cautious with features that require frequent API calls, like "Restart Crashed Dynos" [4].
Consider implementing client-side rate throttling to avoid hitting the limit [5].
The limit is per account, not per application, so all apps under an account share the same limit [4].
There is no limit on incoming requests to applications hosted on Heroku - the limit only applies to calls to Heroku's platform API [3].
Proper rate limiting/throttling is important to avoid exceptions and ensure smooth API usage [5].
By following these guidelines and implementing proper rate limiting, you can effectively work within Heroku's API rate limits and avoid disruptions to your API usage.
Based on the search results provided, the most recent version of the Heroku API is version 3. Here are the key points:
The current and only supported version of the Heroku Platform API is V3 [^5].
To use the current v3 version of the API, you need to pass this header in requests: Accept: application/vnd.heroku+json; version=3
[^5].
The API documentation consistently refers to version 3 in the examples, such as:
$ curl -n https://api.heroku.com/pipelines/$PIPELINE_ID/latest-releases \
-H "Accept: application/vnd.heroku+json; version=3"
[^3]
There is no mention of a newer version (e.g., v4) being available or in development in the provided search results.
The Heroku Connect API also supports version 3 [^4].
It's worth noting that while version 3 is the current version, Heroku has a compatibility policy in place for introducing changes to the API. This policy outlines how changes are communicated and implemented, ensuring stability for existing applications using the API [^5].
[^3]: Heroku Platform API Reference [^4]: Heroku Connect API [^5]: Heroku API Compatibility Policy
To get a developer account for Heroku and create an API integration, you need to follow these steps:
First, you need to sign up for a Heroku account if you don't already have one. Signup is free and instant.
Install the Heroku Command Line Interface (CLI) on your local machine. This will allow you to interact with Heroku from the command line.
To authenticate your API requests, you need to generate an API token. There are two main ways to do this:
For development purposes, you can use heroku auth:token
from the CLI. However, this token expires after 1 year by default.
For production use, it's recommended to create a non-expiring token using heroku authorizations:create
. Here's how:
$ heroku authorizations:create -d "API integration token"
This will output a token that you can use for API requests.
Once you have your token, you can use it to make API requests. Include it in the Authorization
header of your HTTP requests like this:
Authorization: Bearer YOUR_TOKEN_HERE
You can now make requests to the Heroku Platform API. For example, to create a new app:
curl -X POST https://api.heroku.com/apps \
-H "Accept: application/vnd.heroku+json; version=3" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"
Here are the key data models you can interact with using the Heroku API, along with what is possible for each:
The API provides comprehensive access to manage most aspects of Heroku applications, add-ons, and Heroku Connect configurations programmatically. The data models cover core platform functionality as well as Heroku Connect specific operations.