Can I create a User passing the ID?

System Information
  • Strapi Version: 3.6.2
  • Operating System: WSL2 Ubuntu 18.04
  • Database: sqlite3 or mysql
  • Node Version: 12.18.3
  • NPM Version: 6.14.6
  • Yarn Version: 1.22.5

Hello guys. I want to import users, posts, categories, etc, from WordPress. And I need to create the Users with the WordPress ID. The same for the categories because I need to make the relation of the Users and Categories on posts.

Can I do this?

The message when I tried to do this is “[ ‘this field has unspecified keys: id’ ]”. I’ve tried with this object example:

const user = {
  email: '',
  firstname: 'Test',
  lastname: 'Test',
  roles: [3],
  id: 999,


1 Like

Currently not, the id key is stripped before the request is handed off to the database to allow the database to create the ID.

You would likely need a custom controller that uses custom queries to be able to pass this data in as our abstraction layer does quite a bit of sanitation.

Hmmm, I understood.

Thank you.