While Mattermost comes with a set of commands explained in the Command Line Tools, may I know if that helps to cater for your requirement to create user, create team among other commands to configure the system?
In terms of API on the other hand, the first step that you need to perform prior to using it through the page shared by @amy.blais is to create a Personal Access Token.
Have the Personal Access Tokens enabled through System Console > Integrations > Integration Management:
Navigate to Account Settings > Security > Personal Access Tokens and click on Create Token. Take note of the details as you can only pull the information again from the database to see them. For example:
Once that is done, it is gets pretty simple. You can use the API call via cURL / Postman, depending on your preference. For example, sending a message to a channel:
Ahmad-Danials-MacBook-Pro:~ ahmaddanialmohammad$ curl --location --request POST "https://danial.mattermost.com/api/v4/posts" --header "Authorization: Bearer urkdhrx5ciyn9nbrx5anofe1kc" --header "Content-Type: application/json" --header "X-Requested-With: XMLHttpRequest" --data "{\"message\":\"This is a test message\", \"channel_id\":\"6th71ttbg3yy8e97ophbt31obe\"}"
{"id":"ig5mz1dqfpbttjen59hhq9efyc","create_at":1586138093046,"update_at":1586138093046,"edit_at":0,"delete_at":0,"is_pinned":false,"user_id":"5oed8msshj8et8tx3qsyuoxy4h","channel_id":"6th71ttbg3yy8e97ophbt31obe","root_id":"","parent_id":"","original_id":"","message":"This is a test message","type":"","props":{},"hashtags":"","pending_post_id":"","reply_count":0,"metadata":{}}