I am not sure about the API itself in this case, but I believe you are missing an info: a template is either based on start date OR end date. This is built-in. You can change it (by editing a single date and clicking on the button in the popup there) but once defined, you can’t I believe change strategy through the API.
This can be changed by the method Bastien mentions.
When you instantiate a project template via the API, the key parameter for your question is the is_strict parameter.
is_strict = true is the default. If you include is_strict = true or you omit the parameter, then the requested_date gid must match the anchor-date setting inside the template. So in your case, you must have the template set to be anchored to the project start date, but you passed a gid of 2 which doesn’t match, hence the error.
You can bypass this by sending is_strict = false, in which case Asana will not require that your gid type and the internal setting match.