Graylog 3.2 create streams and dashboards via API


Is there a way to create users and dashboards via API calls ? It would be nice to have a script
that can do that and i have tried to call the API for it.
Can’t really get it right so i wonder if someone here has some tips or examples ?

Check Graylog Rest API Browser, it’s a best way to try API calls:

Example of user creation:

curl -i -X POST -u user_token:token -H ‘Content-Type: application/json’ -H ‘X-Requested-By: cli’ ‘’ -d @user.json

File user.json can contains information about user:

“username”: “data”,
“password”: “password”,
“email”: “”,
“full_name”: “Data User”,
“permissions”: [
“timezone”: “UTC”


Thanks @shoothub

I didn’t mean to type users and streams. We have user management via LDAP. I meant to create dashboards and streams via API

If you use LDAP, you don’t need create users in graylog. Just use role map, ans set the rights for roles.

True, the question was about creating streams and dashboards.
I have figured out how to create streams via the API now. But the dashboards are tricky, there seems to be dashboards, legacy dashboards and views

ok, in this case I suggest use the browsers inspector view, and Graylog’s API browser, to check it.
If you do a manual dashboard creation, you can see in the inspection view the traffic.

In 3.2 there is dashboards, legacy dashboards and views.Via dashboards i can only get a list and via Legacy dashboards i can add but they don’t show up in the GUI (but i see them in the ‘get all dashboards’ in the Legacy section but not in the Views section). The dashboards are also in ‘Views’ which i guess is the 3.2 way of handling dashboards but the parameters needed are not very clear

You have also another option to create dashboard. First export dashboard to content pack, edit it and than import it through API:

Import content pack:

curl -i -X POST -u user_token:token -H ‘Content-Type: application/json’ -H ‘X-Requested-By: cli’ ‘’ -d @dashboard.json

Installation of content pack:

curl -i -X POST -u user_token:token -H ‘Content-Type: application/json’ -H ‘X-Requested-By: cli’ ‘’ -d ‘{“parameters”: {},“comment”: “”}’

1 Like

Thanks @shoothub but that way’s too complicated :slight_smile:

@jan Do you have any tips on how to add dashboards via REST API ?

Using the REST API : https://FQDN/api/api-browser/global/index.html#!/Views/create_post_0
i try this string :

“summary”:“This dashboard is a test.”,
“description”:“Test dashboard”,
{“900f81d4-9aa6-11ea-aa01-7365fc383f8c”: {
“titles”: {
“widget”:{ },
“widget_mapping”:{ },
“positions”:{ },
“positions”:{ }

But i get this error :
“type”: “ApiError”,
“message”: “Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 7, column: 13] (through reference chain:$AutoValue_ViewDTO$Builder[“state”])”

Which character has to be escaped ?

The data you send isn’t a valid JSON. You need to remove the double quote after state:

Thanks for the info, removed it and got this :
“type”: “ApiError”,
“message”: “invalid hexadecimal representation of an ObjectId:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.