Title: Call cron process using REST-API
Last modified: February 23, 2024

---

# Call cron process using REST-API

 *  Resolved [jkellis](https://wordpress.org/support/users/jigirene/)
 * (@jigirene)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/call-cron-process-using-rest-api/)
 * I’m having trouble executing the cron process with the REST-API endpoint [https://mydomain.com/wp-json/import-users-from-csv-with-meta/v1/execute-cron/](https://campus.freedomk12.org/wp-json/import-users-from-csv-with-meta/v1/execute-cron/).
   I’m authenticating with admin user credentials and still keep getting a 401 error
   that I’m not authorized. Could you please help me figure out what I’m doing wrong
   here?
 * Here’s the error message I get:
 * **statusCode** 400
 * **error** Bad Request
 * **message** {“code”:”rest_forbidden”,”message”:”Sorry, you are not allowed to
   do that.”,”data”:{“status”:401}}
 * **data** {“code”:”rest_forbidden”,”message”:”Sorry, you are not allowed to do
   that.”,”data”:{“status”:401}}
 * **metadat**a {“request”:{“url”:”[https://mydomain.com/wp-json/import-users-from-csv-with-meta/v1/execute-cron&#8221](https://mydomain.com/wp-json/import-users-from-csv-with-meta/v1/execute-cron&#8221);,”
   method”:”GET”,”body”:null,”headers”:{“User-Agent”:”Retool/2.0 (+https://docs.
   tryretool.com/docs/apis)”,”Authorization”:”—sanitized—“,”ot-baggage-requestId”:”
   undefined”,”x-datadog-trace-id”:”4280003852161843933″,”x-datadog-parent-id”:”
   537839590573450081″,”x-datadog-sampling-priority”:”-1″,”traceparent”:”00-00000000000000003b65a0d3bd6902dd-
   0776ca420e45a361-00″,”tracestate”:”dd=s:-1″,”X-Retool-Forwarded-For”:”35.90.103.133″}},”
   headers”:{“date”:[“Fri, 23 Feb 2024 09:58:10 GMT”],”server”:[“Apache”],”x-powered-
   by”:[“PHP/7.4.33″],”x-xss-protection”:[“1; mode=block”],”strict-transport-security”:[“
   max-age=31536000; includeSubDomains”],”referrer-policy”:[“strict-origin-when-
   cross-origin”],”x-frame-options”:[“sameorigin”],”access-control-allow-origin”:[“*”],”
   x-robots-tag”:[“noindex”],”link”:[“<[https://mydomain.com/wp-json/&gt](https://mydomain.com/wp-json/&gt);;
   rel=\”[https://api.w.org/](https://api.w.org/)\””],”x-content-type-options”:[“
   nosniff”],”access-control-expose-headers”:[“X-WP-Total, X-WP-TotalPages, Link”],”
   access-control-allow-headers”:[“Authorization, X-WP-Nonce, Content-Disposition,
   Content-MD5, Content-Type”],”bbp-unread-messages”:[“323″],”vary”:[“Origin,Accept-
   Encoding”],”upgrade”:[“h2,h2c”],”connection”:[“Upgrade, Keep-Alive”],”keep-alive”:[“
   timeout=5″],”transfer-encoding”:[“chunked”],”content-type”:[“application/json;
   charset=UTF-8″]},”status”:401,”statusText”:”Unauthorized”}

Viewing 1 replies (of 1 total)

 *  Plugin Author [Javier Carazo](https://wordpress.org/support/users/carazo/)
 * (@carazo)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/call-cron-process-using-rest-api/#post-17448411)
 * REST API calls must have the same level of authentication as if they were calls
   made internally.
 * You are probably not authenticated with a sufficient level of permissions.
 * Make the call by authenticating with a user that has a sufficient role to do 
   a user import operation.
 * If not, imagine what a security hole this would be.

Viewing 1 replies (of 1 total)

The topic ‘Call cron process using REST-API’ is closed to new replies.

 * ![](https://ps.w.org/import-users-from-csv-with-meta/assets/icon-256x256.png?
   rev=1174343)
 * [Import and export users and customers](https://wordpress.org/plugins/import-users-from-csv-with-meta/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/import-users-from-csv-with-meta/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/import-users-from-csv-with-meta/)
 * [Active Topics](https://wordpress.org/support/plugin/import-users-from-csv-with-meta/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/import-users-from-csv-with-meta/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/import-users-from-csv-with-meta/reviews/)

## Tags

 * [cron](https://wordpress.org/support/topic-tag/cron/)

 * 1 reply
 * 2 participants
 * Last reply from: [Javier Carazo](https://wordpress.org/support/users/carazo/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/call-cron-process-using-rest-api/#post-17448411)
 * Status: resolved