Added creating the cookie to the API.