Using Railway API to Monitor Current and Maximum Volume Usage

lowscarlet
FREE

a month ago

Hi, I'm currently working on a small school project that's still in development. One of the requirements from the stakeholders is the ability to monitor the current usage and the maximum capacity of the backend volume on Railway.

I've been looking for a way to retrieve this information using the Railway API, but I haven't found clear documentation or an endpoint that directly provides volume usage stats.

Is there a way to programmatically access volume metrics such as current usage and max capacity via the Railway API? If so, could you point me to the relevant endpoint or share an example of how to implement this?

Any guidance would be greatly appreciated.

Solved$20 Bounty

3 Replies

lowscarlet
FREE

a month ago

i don't have any project yet


lowscarlet
FREE

a month ago

like this

1391436892398031000


idiegea21
HOBBYTop 10% Contributor

a month ago

Railway does not provide a direct API endpoint to fetch volume usage via their public API. you can track disk usage using their GraphQL metrics API and set up webhook alerts for high usage. For manual checks, you can use their volume-dump template to inspect data. Combining these helps monitor your volumes effectively.


a month ago

This is possible with the Railway's GraphQL API. Simply use the following query:

query VolumeMetrics($volumeId: String!) {

volumeInstance(id: $volumeId) {

currentSizeMB

sizeMB

}

}

The Volume ID can be obtained through the dashboard by going to the volume and copying the UUID from the path.

It's also obtainable through the API. Let me know if you would like information on that method!


idiegea21

Railway does not provide a direct API endpoint to fetch volume usage via their public API. you can track disk usage using their GraphQL metrics API and set up webhook alerts for high usage. For manual checks, you can use their volume-dump template to inspect data. Combining these helps monitor your volumes effectively.

a month ago

Yes we do, see the answer above.


Status changed to Solved chandrika 15 days ago