Help with 'Order Certificate Pack' api call

Hello,
i am trying to run the next api call based on Cloudflare API v4 Documentation

for some reason while i try to run it (also tried to use Authorization: Bearer header)
i get
{"success":false,"errors":[{"code":1412,"message":"Missing required property in request: type"}],"messages":[],"result":null}

the code i run now is

curl -X POST "https://api.cloudflare.com/client/v4/zones/fake/ssl/certificate_packs" \
        -H "Content-Type:application/json" \
        -H "Authorization: Bearer FAKE_TOKEN" \
        --data '{"hosts":["*.ofir.fake.cool","*.admin.ofir.fake.cool"]}'

what am i missing?

Can you paste that in as plain text? Sometimes smart quotes get mixed in.

it wont allow me to post links in plain text

If you put a ``` above and below your block of text, it will strip out all formatting.

curl -X POST "https://api.cloudflare.com/client/v4/zones/fake/ssl/certificate_packs" \
        -H "Content-Type:application/json" \
        -H "Authorization: Bearer FAKE_TOKEN" \
        --data '{"hosts":["*.ofir.fake.cool","*.admin.ofir.fake.cool"]}'

And the error i get is
{"success":false,"errors":[{"code":1412,"message":"Missing required property in request: type"}],"messages":[],"result":null}

Hmmm…I see the error is a missing Type. It’s quite possibly because your lines aren’t in order. Try putting Authorization above Content-Type.

nope didnt help changing the order

It just feels it’s being nitpicky about something we’re not seeing. How about putting a space after Content-Type: and before application/json

1 Like

tried with/without spaces,
also via postman

if you have a working example it would be great

The API you are using required the hosts to contain the Apex domain, which might be the issue.

It is also a different API to the ACM certificate request API, which looks similar.

1 Like

i have added the Apex domain and still no luck.

ok managed to get this working turns out i needed /order in the end
and type “type”:“advanced”

Thanks for all the helpers

1 Like

Can you please post the request syntax that finally worked?

curl -X POST 'https://api.cloudflare.com/client/v4/zones/fake/ssl/certificate_packs/order' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer fake' \
--data-raw '{
    "type":"advanced",
    "hosts":[
        "*.example.example-site.cool",
        "*.admin.example.example-site.cool",
        "elementor.cool"
        ],
    "validation_method":"txt",
    "validity_days":365,
    "certificate_authority":"digicert",
    "cloudflare_branding":false
}'
1 Like

That looks great! Thanks!

Where did you find that information?

That is the ACM API.

https://developers.cloudflare.com/ssl/edge-certificates/advanced-certificate-manager/api-commands

1 Like

And the API does not document it.

1 Like

It’s a different API URL.

https://api.cloudflare.com/#certificate-packs-order-advanced-certificate-manager-certificate-pack