# Logs of a source using api

**URL:** <https://community.graylog.org/t/logs-of-a-source-using-api/21555>\
**Category:** Graylog Central (peer support)\
**Created:** [October 23, 2021, 9:44am UTC](https://community.graylog.org/t/logs-of-a-source-using-api/21555 "2021-10-23T09:44:12Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![tmacgbay](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/tmacgbay/32/3878_2.png) [@tmacgbay](https://community.graylog.org/u/tmacgbay)\
**Post date:** [October 25, 2021, 2:05pm UTC](https://community.graylog.org/t/logs-of-a-source-using-api/21555/4 "2021-10-25T14:05:30Z")

</div>

A quick search of the forums found this post that might give you a start on how to build an API query for what you want.

> [@How to search messages using REST API](https://community.graylog.org/t/how-to-search-messages-using-rest-api/17943/6):
>
> one open would be to use the relative time, Include the streams ID you want to search in, include the query string in the query\_string object and the time you want to search as relative. The below search will return as CSV/export. ## Search via Export API curl -X "POST" "https://graylog.ch/api/views/search/messages" \ -H 'X-Requested-By: Mamamia' \ -H 'Content-Type: application/json' \ -H 'Accept: text/csv' \ -u 'admin:password' \ -d $'{ "streams": [ "5e569003c7…

---

_[View the full topic](https://community.graylog.org/t/logs-of-a-source-using-api/21555)._
