Export chat completion history

Is it possible to obtain the chat completion history that openai provides, with the api? or automate the export to an external datalake? including metadata