Charles provides some command-line tools that you can use as part of your own automation of Charles.
On each platform, you need to find the path to the Charles binary. On Mac OS X that is /Applications/Charles.app/Contents/MacOS/Charles. On Linux that is just charles, if it is in your path. In these examples, we just write charles to mean the appropriate path to the Charles binary.
The convert tools enables you to convert files between different formats that Charles supports. For example, to convert a .chls file to a .xml file.
Usage: charles convert <infile> <outfile>
Charles determines the desired file type by the suffix on the outfile argument.
To convert a large set of files you could automate running Charles like this using a shell script, or similar.
SSL Root Certificate Export
Export the SSL Root Certificate that Charles has generated.
You can export the certificate to a file. The suffix of the file determines the output format. Supported output formats are .pem, .crt and .p12. If you choose .p12 you need to also provide a password to be used to protect the P12 file.
Usage: charles ssl export <file> [<password>]
You can alternatively output the certificate to stdout. The type defaults to PEM, but you can optionally specify the type as one of PEM, CRT or P12. If you specify P12 you need to also provide a password to be used to protect the P12 file.
Usage: charles ssl export - [<type> [<password>]]