Unified alerting HTTP API in Grafana?

Is there any documentation for the unified alerting HTTP API? Aka, how can I register a new rule by posting the rule yaml payload to an endpoint, same question for the AlertManager configuration.

You can view the specification here
an example for creating a grafana-managed rule querying a prometheus datasource and having 2 expressions reduce and math (the math expression is the rule condition)
the namespace URL parameter should point to an existing folder (under which the rule will be created)

And an example for POSTing an alertmanager configuration

Could I ask if there is a way to drop in prometheus rules yaml into one of these endpoints? Or the rules need to be in specific format that is specicifc to Grafana?

If you use cortex as prometheus datasource you can use POST​ /api​/ruler​/{Recipient}​/api​/v1​/rules​/{Namespace} where the Recipient should be the datasource id but this route expects JSON (not YAML).
An example payload is:

    "name": "group42",
    "rules": [
        {
            "alert": "prom",
            "expr": "(node_filesystem_avail_bytes{job=\"integrations/node_exporter\",fstype!=\"\"} / node_filesystem_size_bytes{job=\"integrations/node_exporter\",fstype!=\"\"} * 100 < 5 and node_filesystem_readonly{job=\"integrations/node_exporter\",fstype!=\"\"} == 0)",
            "for": "1m"
        }
    ]
}```

In that case grafana proxies the request to this route