What permissions does the API user have?
What permissions does the script have?
Which user is the owner of the script?
We just talked about this in another thread.
Here: http://forum.mikrotik.com/t/global-variables-and-user-permission-policy/99366/1