@snim2
I have read the documentation, the API of the sub-module only provides update functions, and the commit API cannot be used to create the sub-module.
Right, so in that case I don’t think it is possible directly from the API.
You could write a script that clones the repo, adds the submodule like you would on the command-line and then pushes back to GitLab. The clone and push could be done via the API, but TBH I’d be inclined to just call git directly from a shell script or a library. Potentially you could do this from within your CI/CD pipeline, and just write it into your .gitlab-ci.yml file, if that makes sense in your workflow.