Use a language-specific SDK instead
At this time we **strongly** recommend using one of our [language-specific SDKs](🔗) instead of Cloudflare Workers. The documentation below is presented for reference only.
Our Cloudflare Workers snippet is not currently being updated. Existing integrations should not be affected, but be aware that any non-security issues that arise may not be immediately resolved. We will be prioritizing fixes in the near future.
Please [contact us](🔗) if you have any questions!
If you'd rather not use one of our language-oriented SDKs for sending your API logs into [ReadMe](🔗) so you can get deep insights on your API's usage with [ReadMe Metrics](🔗), we have another option: Cloudflare Workers!
We have released a [service worker](🔗) app on Cloudflare's App Store, which enables you to send your log data to us at the network layer instead of through your application. This means your API can be written in any language, and you can send logs to ReadMe as long as you are using Cloudflare with the proxy turned on! [You can view our worker here.](🔗)
It's a few small steps if you're a developer! There are only two steps required to get our worker setup with your API.
### In Your API
First, you will need to modify your API to return two new headers with your request. These allow ReadMe to understand who is making the call.
<!-- prettier-ignore-start -->
|`||Unique identifier for the caller. This can be anything that is unique such as an id of a user in your database.|
|`||This will be augment the log in ReadMe, since it's much easier to remember a label than a unique identifier.|
|`||_(Optional)_ For further insight into API calls, you can send an email along with your request to target users more easily.|
<!-- prettier-ignore-end -->
Here's an example of setting these headers in [Express.js](🔗):
### In Cloudflare's Console
Once you are properly returning these headers from your API requests, all you need to do is install the worker in Cloudflare!
Navigate to your domain in Cloudflare's dashboard, then select the Apps tab in the upper right. From here you will be able to search for "ReadMe API Metrics" and preview the app.
Click the blue "Preview on your site" button.
In the page that opens, which allows you to sign in to ReadMe via OAuth:
Select your project
Give Cloudflare your doc project's API key (which you can find at `
Configure which routes the worker should be applied to, i.e., which API routes you want to get usage metrics about.
Once you log in with ReadMe and configure which routes to track on your API, you are all set! Click the install button to finish the process and logs should start appearing in your dashboard as requests come in.
DNS Records Setting
In order for Metrics to function correctly, your DNS Records setting in Cloudflare must use Cloudflare's proxy. This means your "Orange Cloud" should be enabled for your domain!