Create private Dockerhub repo via API

Hi, I am unable to find a precise documentation how to create a private repo via API. First I cant find which api versions are supported. It seems v1 and parts of registry v2? Second I cant find any documentation about create private repos. Does somebody has a clue? Thx in advance.

Hi,

the version of the Docker Hub repository part is v2. Creation of a private repository using the API is done like this:

POST https://hub.docker.com/v2/repositories/ 
Payload: {"namespace":"<your namespace>","name":"<repo name>","description":"<short description> ","full_description":"<long description>","is_private":[true | false]}

But you are right, I can only find API documentation for older versions of Docker Hub. I don’t know if the REST API of Docker Hub actually is public.

Also, if you use private registry, like Docker Trusted Registry, the API is different…

/Ove

I’m getting a 301 permanently moved when I try this endpoint. When I instruct curl to follow redirects I get a {“detail”:“Object not found”} response. Is this still the ideal approach to do this?