{"info":{"name":"Westbase Gateway API","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json","description":"Change the state of your SIMs from your own systems.\n\n**Setup**\n1. Open the collection's **Variables** tab and paste your key into `apiKey` (Current value). Keep it private.\n2. Set `iccid` to one of your SIMs (19 or 20 digits).\n3. Send **SIM state → Get SIM state** to see where the SIM is now.\n4. Send **Change state → Deactivate**, then **Check outcome → Get request** until `status` is `done`.\n\nEvery change is sent with a fresh `Idempotency-Key`, so a retry never changes a SIM twice. To retry a\nrequest deliberately, copy its key into the header instead of `{{idempotencyKey}}`.\n\nChanges are asynchronous: `202` means sent, not done. The **Workflows** folder runs a change and waits\nfor it — open it in the Collection Runner.\n\nFull documentation: `{{baseUrl}}/docs`."},"auth":{"type":"bearer","bearer":[{"key":"token","value":"{{apiKey}}","type":"string"}]},"event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":["pm.collectionVariables.set('idempotencyKey', pm.variables.replaceIn('{{$guid}}'));"]}}],"variable":[{"key":"baseUrl","value":"https://gateway.westbase.io","type":"string"},{"key":"apiKey","value":"","type":"string","description":"Your API key (wbg_live_…). Set it as the Current value; keep it private."},{"key":"iccid","value":"","type":"string","description":"One of your SIMs."},{"key":"requestId","value":"","type":"string","description":"Saved from the last 202."},{"key":"idempotencyKey","value":"","type":"string","description":"Generated per send."},{"key":"pollCount","value":"0","type":"string"}],"item":[{"name":"SIM state","item":[{"name":"Get SIM state","response":[{"name":"200 OK — active","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":200,"status":"OK","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"iccid\": \"89999000000000000011\",\n  \"state\": \"ACTIVE\",\n  \"locked\": false,\n  \"allowed_states\": [\n    \"DEACTIVATED\",\n    \"PAUSE\"\n  ]\n}"},{"name":"200 OK — locked","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":200,"status":"OK","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"iccid\": \"89999000000000000011\",\n  \"state\": \"ACTIVE\",\n  \"locked\": true,\n  \"allowed_states\": []\n}"},{"name":"400 invalid_request","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":400,"status":"Bad Request","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"invalid_request\",\n    \"message\": \"The request body or parameters are malformed.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"400 invalid_iccid","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":400,"status":"Bad Request","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"invalid_iccid\",\n    \"message\": \"The ICCID must be 19 or 20 digits.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"401 unauthorized","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":401,"status":"Unauthorized","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"unauthorized\",\n    \"message\": \"Missing, invalid, expired or revoked API key.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"403 forbidden","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":403,"status":"Forbidden","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"forbidden\",\n    \"message\": \"This API key does not have permission for this operation.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"403 customer_not_enabled","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":403,"status":"Forbidden","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"customer_not_enabled\",\n    \"message\": \"SIM state changes are not enabled for your account.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"404 sim_not_found","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":404,"status":"Not Found","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"sim_not_found\",\n    \"message\": \"No SIM with this ICCID exists on your account.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"422 carrier_not_supported","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":422,"status":"Unprocessable Entity","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"carrier_not_supported\",\n    \"message\": \"State changes are not yet available for this SIM.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"429 rate_limited","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":429,"status":"Too Many Requests","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"rate_limited\",\n    \"message\": \"Too many requests. Retry after the number of seconds in Retry-After.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"502 carrier_unavailable","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":502,"status":"Bad Gateway","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"carrier_unavailable\",\n    \"message\": \"The network could not be reached. Nothing was changed; it is safe to retry.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"502 carrier_error","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":502,"status":"Bad Gateway","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"carrier_error\",\n    \"message\": \"The network returned an unexpected response. Nothing was changed.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"503 not_configured","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":503,"status":"Service Unavailable","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"not_configured\",\n    \"message\": \"This deployment does not serve the API.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"}],"request":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]},"description":"The SIM's current state, read live from the network, and the states you can move it to right now."},"event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test('Documented response shape', function () {","    const body = pm.response.json();","    if (pm.response.code >= 400) {","        pm.expect(body.error).to.have.keys('code', 'message', 'request_id');","    } else {","        pm.expect(body).to.have.keys('iccid', 'state', 'locked', 'allowed_states');","    }","});"]}}]}]},{"name":"Change state","item":[{"name":"Deactivate","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]},"description":"Stop the SIM connecting."},"response":[{"name":"202 Accepted — sent, poll it","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":202,"status":"Accepted","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"ACTIVE\",\n  \"requested_state\": \"DEACTIVATED\",\n  \"status\": \"submitted\"\n}"},{"name":"200 OK — already in that state","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":200,"status":"OK","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"DEACTIVATED\",\n  \"requested_state\": \"DEACTIVATED\",\n  \"status\": \"done\",\n  \"no_change\": true\n}"},{"name":"400 invalid_request","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":400,"status":"Bad Request","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"invalid_request\",\n    \"message\": \"The request body or parameters are malformed.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"400 invalid_iccid","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":400,"status":"Bad Request","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"invalid_iccid\",\n    \"message\": \"The ICCID must be 19 or 20 digits.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"401 unauthorized","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":401,"status":"Unauthorized","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"unauthorized\",\n    \"message\": \"Missing, invalid, expired or revoked API key.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"403 forbidden","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":403,"status":"Forbidden","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"forbidden\",\n    \"message\": \"This API key does not have permission for this operation.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"403 customer_not_enabled","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":403,"status":"Forbidden","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"customer_not_enabled\",\n    \"message\": \"SIM state changes are not enabled for your account.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"404 sim_not_found","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":404,"status":"Not Found","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"sim_not_found\",\n    \"message\": \"No SIM with this ICCID exists on your account.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"409 sim_locked","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":409,"status":"Conflict","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"sim_locked\",\n    \"message\": \"The SIM is locked and cannot change state.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"409 state_transition_not_allowed","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":409,"status":"Conflict","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"state_transition_not_allowed\",\n    \"message\": \"The SIM's current state does not allow this change.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"409 change_in_progress","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":409,"status":"Conflict","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"change_in_progress\",\n    \"message\": \"A request with this Idempotency-Key is still being sent. Check the request_id in this error for its outcome.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"409 idempotency_key_reused","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":409,"status":"Conflict","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"idempotency_key_reused\",\n    \"message\": \"This Idempotency-Key was already used for a different request.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"422 state_not_allowed","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":422,"status":"Unprocessable Entity","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"state_not_allowed\",\n    \"message\": \"This target state is not available on your account.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"422 carrier_not_supported","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":422,"status":"Unprocessable Entity","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"carrier_not_supported\",\n    \"message\": \"State changes are not yet available for this SIM.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"422 carrier_refused","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":422,"status":"Unprocessable Entity","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"carrier_refused\",\n    \"message\": \"The network refused the state change. Nothing was changed.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"429 rate_limited","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":429,"status":"Too Many Requests","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"rate_limited\",\n    \"message\": \"Too many requests. Retry after the number of seconds in Retry-After.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"502 carrier_unavailable","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":502,"status":"Bad Gateway","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"carrier_unavailable\",\n    \"message\": \"The network could not be reached. Nothing was changed; it is safe to retry.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"502 carrier_unconfirmed","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":502,"status":"Bad Gateway","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"carrier_unconfirmed\",\n    \"message\": \"The network did not confirm the request. Do not resend it: poll the request to learn the outcome.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"502 carrier_error","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":502,"status":"Bad Gateway","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"carrier_error\",\n    \"message\": \"The network returned an unexpected response. Nothing was changed.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"503 not_configured","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":503,"status":"Service Unavailable","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"not_configured\",\n    \"message\": \"This deployment does not serve the API.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"}],"event":[{"listen":"test","script":{"type":"text/javascript","exec":["if (pm.response.code === 202) {","    pm.collectionVariables.set('requestId', pm.response.json().request_id);","}","pm.test('Documented response shape', function () {","    const body = pm.response.json();","    if (pm.response.code >= 400) {","        pm.expect(body.error).to.have.keys('code', 'message', 'request_id');","    } else {","        pm.expect(body).to.include.keys('request_id', 'iccid', 'status');","    }","});"]}}]},{"name":"Activate","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"ACTIVE\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]},"description":"Let the SIM connect again (from DEACTIVATED or PAUSE)."},"response":[{"name":"202 Accepted — sent, poll it","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"ACTIVE\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":202,"status":"Accepted","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"DEACTIVATED\",\n  \"requested_state\": \"ACTIVE\",\n  \"status\": \"submitted\"\n}"},{"name":"200 OK — already in that state","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"ACTIVE\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":200,"status":"OK","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"ACTIVE\",\n  \"requested_state\": \"ACTIVE\",\n  \"status\": \"done\",\n  \"no_change\": true\n}"}],"event":[{"listen":"test","script":{"type":"text/javascript","exec":["if (pm.response.code === 202) {","    pm.collectionVariables.set('requestId', pm.response.json().request_id);","}","pm.test('Documented response shape', function () {","    const body = pm.response.json();","    if (pm.response.code >= 400) {","        pm.expect(body.error).to.have.keys('code', 'message', 'request_id');","    } else {","        pm.expect(body).to.include.keys('request_id', 'iccid', 'status');","    }","});"]}}]},{"name":"Pause","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"PAUSE\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]},"description":"Pause the SIM. Available only if enabled for your account."},"response":[{"name":"202 Accepted — sent, poll it","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"PAUSE\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":202,"status":"Accepted","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"ACTIVE\",\n  \"requested_state\": \"PAUSE\",\n  \"status\": \"submitted\"\n}"},{"name":"200 OK — already in that state","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"PAUSE\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"code":200,"status":"OK","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"PAUSE\",\n  \"requested_state\": \"PAUSE\",\n  \"status\": \"done\",\n  \"no_change\": true\n}"}],"event":[{"listen":"test","script":{"type":"text/javascript","exec":["if (pm.response.code === 202) {","    pm.collectionVariables.set('requestId', pm.response.json().request_id);","}","pm.test('Documented response shape', function () {","    const body = pm.response.json();","    if (pm.response.code >= 400) {","        pm.expect(body.error).to.have.keys('code', 'message', 'request_id');","    } else {","        pm.expect(body).to.include.keys('request_id', 'iccid', 'status');","    }","});"]}}]}],"description":"`202` means sent, not done — then use **Check outcome**."},{"name":"Check outcome","item":[{"name":"Get request","response":[{"name":"submitted — waiting for the SIM","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":200,"status":"OK","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"ACTIVE\",\n  \"requested_state\": \"DEACTIVATED\",\n  \"created_at\": \"2026-10-01T09:30:00+00:00\",\n  \"status\": \"submitted\",\n  \"completed_at\": null,\n  \"error\": null\n}"},{"name":"unconfirmed — do not resend, keep polling","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":200,"status":"OK","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"ACTIVE\",\n  \"requested_state\": \"DEACTIVATED\",\n  \"created_at\": \"2026-10-01T09:30:00+00:00\",\n  \"status\": \"unconfirmed\",\n  \"completed_at\": null,\n  \"error\": null\n}"},{"name":"done — the SIM is in the requested state","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":200,"status":"OK","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"ACTIVE\",\n  \"requested_state\": \"DEACTIVATED\",\n  \"created_at\": \"2026-10-01T09:30:00+00:00\",\n  \"status\": \"done\",\n  \"completed_at\": \"2026-10-01T09:30:04+00:00\",\n  \"error\": null\n}"},{"name":"refused — nothing changed","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":200,"status":"OK","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"ACTIVE\",\n  \"requested_state\": \"DEACTIVATED\",\n  \"created_at\": \"2026-10-01T09:30:00+00:00\",\n  \"status\": \"refused\",\n  \"completed_at\": \"2026-10-01T09:30:01+00:00\",\n  \"error\": {\n    \"code\": \"carrier_refused\",\n    \"message\": \"The network refused the state change. Nothing was changed.\"\n  }\n}"},{"name":"failed — another change to the SIM won","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":200,"status":"OK","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"ACTIVE\",\n  \"requested_state\": \"DEACTIVATED\",\n  \"created_at\": \"2026-10-01T09:30:00+00:00\",\n  \"status\": \"failed\",\n  \"completed_at\": \"2026-10-01T09:30:04+00:00\",\n  \"error\": {\n    \"code\": \"change_in_progress\",\n    \"message\": \"Another change to this SIM was being applied at the same moment, so the network rejected this one. This request changed nothing.\"\n  }\n}"},{"name":"failed — not applied","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":200,"status":"OK","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\",\n  \"iccid\": \"89999000000000000011\",\n  \"from_state\": \"ACTIVE\",\n  \"requested_state\": \"DEACTIVATED\",\n  \"created_at\": \"2026-10-01T09:30:00+00:00\",\n  \"status\": \"failed\",\n  \"completed_at\": \"2026-10-01T09:30:04+00:00\",\n  \"error\": {\n    \"code\": \"not_applied\",\n    \"message\": \"The network accepted the request but did not apply it. Nothing was changed.\"\n  }\n}"},{"name":"400 invalid_request","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":400,"status":"Bad Request","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"invalid_request\",\n    \"message\": \"The request body or parameters are malformed.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"401 unauthorized","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":401,"status":"Unauthorized","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"unauthorized\",\n    \"message\": \"Missing, invalid, expired or revoked API key.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"404 request_not_found","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":404,"status":"Not Found","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"request_not_found\",\n    \"message\": \"No request with this id exists on your account.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"429 rate_limited","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":429,"status":"Too Many Requests","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"rate_limited\",\n    \"message\": \"Too many requests. Retry after the number of seconds in Retry-After.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"502 outcome_unavailable","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":502,"status":"Bad Gateway","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"outcome_unavailable\",\n    \"message\": \"The outcome could not be checked with the network just now. Try again in a few seconds.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"},{"name":"503 not_configured","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]}},"code":503,"status":"Service Unavailable","header":[{"key":"Content-Type","value":"application/json"}],"_postman_previewlanguage":"json","body":"{\n  \"error\": {\n    \"code\": \"not_configured\",\n    \"message\": \"This deployment does not serve the API.\",\n    \"request_id\": \"3f0c2b9e-6a4d-4a8e-9a53-1c2d3e4f5a6b\"\n  }\n}"}],"request":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]},"description":"Poll every few seconds until `status` is `done`, `refused` or `failed`. Uses `requestId`, saved by the last `202`."}}]},{"name":"Workflows (Collection Runner)","description":"Run this folder in the Collection Runner: deactivate, wait until done, activate, wait until done. Stops at the first change that doesn't complete.","item":[{"name":"1 · Deactivate","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"DEACTIVATED\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"event":[{"listen":"test","script":{"type":"text/javascript","exec":["if (pm.response.code === 202) {","    pm.collectionVariables.set('requestId', pm.response.json().request_id);","}","pm.test('Documented response shape', function () {","    const body = pm.response.json();","    if (pm.response.code >= 400) {","        pm.expect(body.error).to.have.keys('code', 'message', 'request_id');","    } else {","        pm.expect(body).to.include.keys('request_id', 'iccid', 'status');","    }","});","if (pm.response.code !== 202) { postman.setNextRequest(null); }"]}}]},{"name":"2 · Wait until deactivated","request":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]},"description":"Polls every 3 s (up to ~2 minutes) in the Collection Runner."},"event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":["setTimeout(function () {}, 3000);"]}},{"listen":"test","script":{"type":"text/javascript","exec":["const body = pm.response.json();","const finished = ['done', 'refused', 'failed'].includes(body.status);","const tries = Number(pm.collectionVariables.get('pollCount') || 0) + 1;","pm.collectionVariables.set('pollCount', tries);","if (!finished && tries < 40) {","    postman.setNextRequest('2 · Wait until deactivated');","} else {","    pm.collectionVariables.set('pollCount', 0);","    pm.test('Change finished as done', function () { pm.expect(body.status).to.eql('done'); });","    postman.setNextRequest('3 · Activate');","}"]}}]},{"name":"3 · Activate","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Idempotency-Key","value":"{{idempotencyKey}}","description":"Generated fresh for every send."}],"body":{"mode":"raw","raw":"{\"state\": \"ACTIVE\"}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/v1/sims/{{iccid}}/state","host":["{{baseUrl}}"],"path":["v1","sims","{{iccid}}","state"]}},"event":[{"listen":"test","script":{"type":"text/javascript","exec":["if (pm.response.code === 202) {","    pm.collectionVariables.set('requestId', pm.response.json().request_id);","}","pm.test('Documented response shape', function () {","    const body = pm.response.json();","    if (pm.response.code >= 400) {","        pm.expect(body.error).to.have.keys('code', 'message', 'request_id');","    } else {","        pm.expect(body).to.include.keys('request_id', 'iccid', 'status');","    }","});","if (pm.response.code !== 202) { postman.setNextRequest(null); }"]}}]},{"name":"4 · Wait until active","request":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/v1/requests/{{requestId}}","host":["{{baseUrl}}"],"path":["v1","requests","{{requestId}}"]},"description":"Polls every 3 s (up to ~2 minutes) in the Collection Runner."},"event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":["setTimeout(function () {}, 3000);"]}},{"listen":"test","script":{"type":"text/javascript","exec":["const body = pm.response.json();","const finished = ['done', 'refused', 'failed'].includes(body.status);","const tries = Number(pm.collectionVariables.get('pollCount') || 0) + 1;","pm.collectionVariables.set('pollCount', tries);","if (!finished && tries < 40) {","    postman.setNextRequest('4 · Wait until active');","} else {","    pm.collectionVariables.set('pollCount', 0);","    pm.test('Change finished as done', function () { pm.expect(body.status).to.eql('done'); });","    postman.setNextRequest(null);","}"]}}]}]}]}