Download the latest dbml file in ci/cd pipeline

I want to be able to download the latest dbml file in from dbdiagram.io in my ci/cd process. Does anyone know how to do this? Is this possible?

Hi there,

To solve your problem, please see our previous post in this community thread about using dbdiagram’s public API: https://community.dbdiagram.io/t/use-js-to-interact-with-the-editor/2227/2?u=huy_phung

In this case, you must make a GET request to retrieve the dbml content. This is an example of a request:

requests.get(f'https://api.dbdiagram.io/query/{your_diagram_id}', headers=headers)

However, this is only a workaround. We’ll soon consider officially introducing our API.

Best regards
Huy Phung

My diagram is not a public diagram, it’s a private diagram.

To get my diagram id, I went to the url for my diagram and copied it from there:

Then I ran this command and I’m getting a 403 Forbidden error.
curl --request GET
–url https://api.dbdiagram.io/query/my-diagram-id-xyz

Do I have to add some auth parameter like a header or something else to my call?

Hi looper33,

Thank you for sharing your case with us. Unfortunately, we regret to inform you that public API for fetching private diagrams is not supported at the moment.

Thanks.