[{"data":1,"prerenderedAt":1120},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fauthentication":3},{"id":4,"title":5,"body":6,"description":1111,"extension":1112,"meta":1113,"navigation":1114,"order":54,"path":1115,"seo":1116,"seoTitle":1117,"stem":1118,"__hash__":1119},"docs\u002Fdocs\u002Fauthentication.md","Authentication",{"type":7,"value":8,"toc":1101},"minimark",[9,13,26,61,66,91,99,103,192,206,217,221,228,282,304,308,315,373,402,447,451,454,654,672,677,1072,1083,1087,1097],[10,11,5],"h1",{"id":12},"authentication",[14,15,16,17,21,22,25],"p",{},"Every request to ",[18,19,20],"code",{},"https:\u002F\u002Fpogton.com\u002Fapi\u002Fv1"," needs an API key in the ",[18,23,24],{},"Authorization"," header. Call the API from your server only; anyone with the key can publish for every user of your organization.",[27,28,33],"pre",{"className":29,"code":30,"language":31,"meta":32,"style":32},"language-bash shiki shiki-themes github-light github-dark","curl https:\u002F\u002Fpogton.com\u002Fapi\u002Fv1\u002Fusers \\\n  -H \"Authorization: Bearer pk_3f9a...\"\n","bash","",[18,34,35,52],{"__ignoreMap":32},[36,37,40,44,48],"span",{"class":38,"line":39},"line",1,[36,41,43],{"class":42},"sScJk","curl",[36,45,47],{"class":46},"sZZnC"," https:\u002F\u002Fpogton.com\u002Fapi\u002Fv1\u002Fusers",[36,49,51],{"class":50},"sj4cs"," \\\n",[36,53,55,58],{"class":38,"line":54},2,[36,56,57],{"class":50},"  -H",[36,59,60],{"class":46}," \"Authorization: Bearer pk_3f9a...\"\n",[62,63,65],"h2",{"id":64},"creating-a-key","Creating a key",[67,68,69,78,88],"ol",{},[70,71,72,73,77],"li",{},"In the dashboard, go to ",[74,75,76],"strong",{},"Connect → API",".",[70,79,80,81,84,85,77],{},"Create a key, give it a name and choose ",[74,82,83],{},"Live"," or ",[74,86,87],{},"Test",[70,89,90],{},"Copy the key. It is shown once; Pogton only stores a hash.",[14,92,93,94,77],{},"You can have several keys and revoke one at any time. A revoked key stops working immediately. Connect links signed with a revoked key stop working too. You can also list, create, roll and revoke keys ",[95,96,98],"a",{"href":97},"\u002Fdocs\u002Fapi-keys","through the API",[62,100,102],{"id":101},"live-and-test-keys","Live and test keys",[104,105,106,121],"table",{},[107,108,109],"thead",{},[110,111,112,115,118],"tr",{},[113,114],"th",{},[113,116,117],{},"Live key",[113,119,120],{},"Test key",[122,123,124,140,155,166,181],"tbody",{},[110,125,126,130,135],{},[127,128,129],"td",{},"Prefix",[127,131,132],{},[18,133,134],{},"pk_",[127,136,137],{},[18,138,139],{},"pk_test_",[110,141,142,145,148],{},[127,143,144],{},"Accounts",[127,146,147],{},"Real accounts your users connected",[127,149,150,154],{},[95,151,153],{"href":152},"\u002Fdocs\u002Fsandbox","Sandbox accounts"," only",[110,156,157,160,163],{},[127,158,159],{},"Publishing",[127,161,162],{},"Publishes to the platforms",[127,164,165],{},"Validates, then simulates publishing",[110,167,168,171,174],{},[127,169,170],{},"Webhooks",[127,172,173],{},"Sent",[127,175,176,177,180],{},"Sent, with ",[18,178,179],{},"\"test\": true"," on post events",[110,182,183,186,189],{},[127,184,185],{},"Webhook URLs",[127,187,188],{},"HTTPS only",[127,190,191],{},"HTTP allowed, for local tunnels",[14,193,194,195,198,199,84,202,205],{},"Every response has an ",[18,196,197],{},"X-Pogton-Mode"," header with ",[18,200,201],{},"live",[18,203,204],{},"test",", so you can check which mode a request ran in.",[14,207,208,209,212,213,216],{},"A live key can't publish to a sandbox account and a test key can't publish to a real one; both get ",[18,210,211],{},"403 mode_mismatch",". ",[18,214,215],{},"GET \u002Fapi\u002Fv1\u002Faccounts"," only lists accounts of the key's mode.",[62,218,220],{"id":219},"rate-limits","Rate limits",[14,222,223,224,227],{},"Each key can make ",[74,225,226],{},"300 requests per minute",". The window is a fixed minute. Every response says where you are:",[104,229,230,240],{},[107,231,232],{},[110,233,234,237],{},[113,235,236],{},"Header",[113,238,239],{},"Meaning",[122,241,242,252,262,272],{},[110,243,244,249],{},[127,245,246],{},[18,247,248],{},"X-RateLimit-Limit",[127,250,251],{},"Requests allowed per minute (300)",[110,253,254,259],{},[127,255,256],{},[18,257,258],{},"X-RateLimit-Remaining",[127,260,261],{},"Requests left in this window",[110,263,264,269],{},[127,265,266],{},[18,267,268],{},"X-RateLimit-Reset",[127,270,271],{},"Unix time (seconds) when the window resets",[110,273,274,279],{},[127,275,276],{},[18,277,278],{},"Retry-After",[127,280,281],{},"On a 429 only: seconds to wait",[14,283,284,285,288,289,291,292,296,297,303],{},"Over the limit, the API returns ",[18,286,287],{},"429 rate_limited",". Wait ",[18,290,278],{}," seconds and try again. Requests to the ",[95,293,295],{"href":294},"\u002Fdocs\u002Fmcp","MCP server"," count against the same limit. To publish many posts at once, use ",[95,298,300],{"href":299},"\u002Fdocs\u002Fpublishing#batch",[18,301,302],{},"POST \u002Fapi\u002Fv1\u002Fposts\u002Fbatch",": one request for up to 50 posts.",[62,305,307],{"id":306},"idempotency","Idempotency",[14,309,310,311,314],{},"Network errors happen. To retry a request that creates something without doing it twice, send an ",[18,312,313],{},"Idempotency-Key"," header with a unique value, such as a UUID:",[27,316,318],{"className":29,"code":317,"language":31,"meta":32,"style":32},"curl -X POST https:\u002F\u002Fpogton.com\u002Fapi\u002Fv1\u002Fposts \\\n  -H \"Authorization: Bearer pk_3f9a...\" \\\n  -H \"Idempotency-Key: 0b6a8f8e-3c1d-4d55-9a57-2f2f1a6c9e10\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"account_ids\": [\"j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed\"], \"content\": \"Hello\" }'\n",[18,319,320,335,344,354,364],{"__ignoreMap":32},[36,321,322,324,327,330,333],{"class":38,"line":39},[36,323,43],{"class":42},[36,325,326],{"class":50}," -X",[36,328,329],{"class":46}," POST",[36,331,332],{"class":46}," https:\u002F\u002Fpogton.com\u002Fapi\u002Fv1\u002Fposts",[36,334,51],{"class":50},[36,336,337,339,342],{"class":38,"line":54},[36,338,57],{"class":50},[36,340,341],{"class":46}," \"Authorization: Bearer pk_3f9a...\"",[36,343,51],{"class":50},[36,345,347,349,352],{"class":38,"line":346},3,[36,348,57],{"class":50},[36,350,351],{"class":46}," \"Idempotency-Key: 0b6a8f8e-3c1d-4d55-9a57-2f2f1a6c9e10\"",[36,353,51],{"class":50},[36,355,357,359,362],{"class":38,"line":356},4,[36,358,57],{"class":50},[36,360,361],{"class":46}," \"Content-Type: application\u002Fjson\"",[36,363,51],{"class":50},[36,365,367,370],{"class":38,"line":366},5,[36,368,369],{"class":50},"  -d",[36,371,372],{"class":46}," '{ \"account_ids\": [\"j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed\"], \"content\": \"Hello\" }'\n",[374,375,376,383,389,396,399],"ul",{},[70,377,378,379,382],{},"A repeat with the same key and the same body returns the first response, status code included, with ",[18,380,381],{},"Idempotent-Replayed: true",". Nothing is published again.",[70,384,385,386,77],{},"The same key with a different body returns ",[18,387,388],{},"422 idempotency_conflict",[70,390,391,392,395],{},"A repeat while the first request is still running returns ",[18,393,394],{},"409 idempotency_in_progress",". Wait a moment and retry.",[70,397,398],{},"Errors are stored too. After fixing a rejected request, send it with a new key.",[70,400,401],{},"Keys are kept for 24 hours and are scoped to your organization. The maximum length is 255 characters.",[14,403,404,405,408,409,408,412,408,415,408,418,408,421,408,424,408,427,408,430,408,433,408,436,408,439,442,443,446],{},"These endpoints accept the header: ",[18,406,407],{},"POST \u002Fposts",", ",[18,410,411],{},"POST \u002Fposts\u002Fbatch",[18,413,414],{},"POST \u002Fposts\u002Fschedule",[18,416,417],{},"POST \u002Fposts\u002F{id}\u002Fpublish",[18,419,420],{},"POST \u002Fposts\u002F{id}\u002Fretry",[18,422,423],{},"POST \u002Fposts\u002F{id}\u002Fcomments",[18,425,426],{},"POST \u002Fconnect-link",[18,428,429],{},"POST \u002Fconnect\u002Fauthorize",[18,431,432],{},"POST \u002Fconnect\u002Fsessions\u002F{token}\u002Fselect",[18,434,435],{},"POST \u002Fmedia\u002Fupload-url",[18,437,438],{},"POST \u002Fmedia",[18,440,441],{},"POST \u002Fwebhooks"," and ",[18,444,445],{},"POST \u002Fwebhooks\u002F{id}\u002Frotate-secret",". Other endpoints ignore it.",[62,448,450],{"id":449},"errors","Errors",[14,452,453],{},"Errors use HTTP status codes and one JSON shape:",[27,455,459],{"className":456,"code":457,"language":458,"meta":32,"style":32},"language-json shiki shiki-themes github-light github-dark","{\n  \"statusCode\": 422,\n  \"statusMessage\": \"The post does not meet the rules of one or more platforms\",\n  \"data\": {\n    \"error\": {\n      \"code\": \"validation_failed\",\n      \"message\": \"The post does not meet the rules of one or more platforms\",\n      \"details\": [\n        {\n          \"field\": \"content\",\n          \"code\": \"text_too_long\",\n          \"message\": \"X allows 280 characters; this text counts as 312\",\n          \"severity\": \"error\",\n          \"platform\": \"twitter\",\n          \"account_id\": \"j97ab3c4d5e6f7g8h9j0k1m2n3p4q5rs\"\n        }\n      ]\n    }\n  }\n}\n","json",[18,460,461,467,481,493,501,508,521,533,542,548,561,574,587,600,613,624,630,636,642,648],{"__ignoreMap":32},[36,462,463],{"class":38,"line":39},[36,464,466],{"class":465},"sVt8B","{\n",[36,468,469,472,475,478],{"class":38,"line":54},[36,470,471],{"class":50},"  \"statusCode\"",[36,473,474],{"class":465},": ",[36,476,477],{"class":50},"422",[36,479,480],{"class":465},",\n",[36,482,483,486,488,491],{"class":38,"line":346},[36,484,485],{"class":50},"  \"statusMessage\"",[36,487,474],{"class":465},[36,489,490],{"class":46},"\"The post does not meet the rules of one or more platforms\"",[36,492,480],{"class":465},[36,494,495,498],{"class":38,"line":356},[36,496,497],{"class":50},"  \"data\"",[36,499,500],{"class":465},": {\n",[36,502,503,506],{"class":38,"line":366},[36,504,505],{"class":50},"    \"error\"",[36,507,500],{"class":465},[36,509,511,514,516,519],{"class":38,"line":510},6,[36,512,513],{"class":50},"      \"code\"",[36,515,474],{"class":465},[36,517,518],{"class":46},"\"validation_failed\"",[36,520,480],{"class":465},[36,522,524,527,529,531],{"class":38,"line":523},7,[36,525,526],{"class":50},"      \"message\"",[36,528,474],{"class":465},[36,530,490],{"class":46},[36,532,480],{"class":465},[36,534,536,539],{"class":38,"line":535},8,[36,537,538],{"class":50},"      \"details\"",[36,540,541],{"class":465},": [\n",[36,543,545],{"class":38,"line":544},9,[36,546,547],{"class":465},"        {\n",[36,549,551,554,556,559],{"class":38,"line":550},10,[36,552,553],{"class":50},"          \"field\"",[36,555,474],{"class":465},[36,557,558],{"class":46},"\"content\"",[36,560,480],{"class":465},[36,562,564,567,569,572],{"class":38,"line":563},11,[36,565,566],{"class":50},"          \"code\"",[36,568,474],{"class":465},[36,570,571],{"class":46},"\"text_too_long\"",[36,573,480],{"class":465},[36,575,577,580,582,585],{"class":38,"line":576},12,[36,578,579],{"class":50},"          \"message\"",[36,581,474],{"class":465},[36,583,584],{"class":46},"\"X allows 280 characters; this text counts as 312\"",[36,586,480],{"class":465},[36,588,590,593,595,598],{"class":38,"line":589},13,[36,591,592],{"class":50},"          \"severity\"",[36,594,474],{"class":465},[36,596,597],{"class":46},"\"error\"",[36,599,480],{"class":465},[36,601,603,606,608,611],{"class":38,"line":602},14,[36,604,605],{"class":50},"          \"platform\"",[36,607,474],{"class":465},[36,609,610],{"class":46},"\"twitter\"",[36,612,480],{"class":465},[36,614,616,619,621],{"class":38,"line":615},15,[36,617,618],{"class":50},"          \"account_id\"",[36,620,474],{"class":465},[36,622,623],{"class":46},"\"j97ab3c4d5e6f7g8h9j0k1m2n3p4q5rs\"\n",[36,625,627],{"class":38,"line":626},16,[36,628,629],{"class":465},"        }\n",[36,631,633],{"class":38,"line":632},17,[36,634,635],{"class":465},"      ]\n",[36,637,639],{"class":38,"line":638},18,[36,640,641],{"class":465},"    }\n",[36,643,645],{"class":38,"line":644},19,[36,646,647],{"class":465},"  }\n",[36,649,651],{"class":38,"line":650},20,[36,652,653],{"class":465},"}\n",[14,655,656,657,660,661,664,665,668,669,77],{},"Branch on ",[18,658,659],{},"data.error.code","; it is stable. Messages are for people and may change. ",[18,662,663],{},"details"," is set for validation errors: a list of ",[18,666,667],{},"{ field, message }"," for a malformed request, or platform issues for ",[18,670,671],{},"validation_failed",[673,674,676],"h3",{"id":675},"error-codes","Error codes",[104,678,679,691],{},[107,680,681],{},[110,682,683,686,689],{},[113,684,685],{},"Status",[113,687,688],{},"Code",[113,690,239],{},[122,692,693,709,721,733,745,757,770,783,795,807,841,853,866,881,899,911,929,941,953,967,979,994,1012,1026,1039,1056],{},[110,694,695,698,703],{},[127,696,697],{},"400",[127,699,700],{},[18,701,702],{},"validation_error",[127,704,705,706,708],{},"The body or query doesn't match the schema. ",[18,707,663],{}," lists the fields.",[110,710,711,713,718],{},[127,712,697],{},[127,714,715],{},[18,716,717],{},"invalid_json",[127,719,720],{},"The body is not valid JSON.",[110,722,723,725,730],{},[127,724,697],{},[127,726,727],{},[18,728,729],{},"invalid_request",[127,731,732],{},"A parameter is missing or doesn't make sense, e.g. a reply without a single account.",[110,734,735,737,742],{},[127,736,697],{},[127,738,739],{},[18,740,741],{},"not_supported",[127,743,744],{},"The platform doesn't support this, e.g. deleting a TikTok post.",[110,746,747,749,754],{},[127,748,697],{},[127,750,751],{},[18,752,753],{},"unsupported_platform",[127,755,756],{},"Unknown platform slug.",[110,758,759,762,767],{},[127,760,761],{},"401",[127,763,764],{},[18,765,766],{},"unauthorized",[127,768,769],{},"Missing, malformed, unknown or revoked API key.",[110,771,772,775,780],{},[127,773,774],{},"403",[127,776,777],{},[18,778,779],{},"mode_mismatch",[127,781,782],{},"A live key used a sandbox account, or a test key a real one.",[110,784,785,787,792],{},[127,786,774],{},[127,788,789],{},[18,790,791],{},"test_mode_only",[127,793,794],{},"The endpoint needs a test key.",[110,796,797,799,804],{},[127,798,774],{},[127,800,801],{},[18,802,803],{},"permission_denied",[127,805,806],{},"The platform refused: a scope or app review is missing.",[110,808,809,812,838],{},[127,810,811],{},"404",[127,813,814,408,817,408,820,408,823,408,826,408,829,408,832,408,835],{},[18,815,816],{},"post_not_found",[18,818,819],{},"account_not_found",[18,821,822],{},"user_not_found",[18,824,825],{},"media_not_found",[18,827,828],{},"upload_not_found",[18,830,831],{},"webhook_not_found",[18,833,834],{},"delivery_not_found",[18,836,837],{},"not_found",[127,839,840],{},"The resource doesn't exist, or belongs to another organization.",[110,842,843,845,850],{},[127,844,811],{},[127,846,847],{},[18,848,849],{},"unknown_resource",[127,851,852],{},"The platform has no lookup list of that kind.",[110,854,855,858,863],{},[127,856,857],{},"409",[127,859,860],{},[18,861,862],{},"account_revoked",[127,864,865],{},"The account was disconnected.",[110,867,868,870,875],{},[127,869,857],{},[127,871,872],{},[18,873,874],{},"auth_expired",[127,876,877,878,77],{},"The platform rejected the account's token. The account is now ",[18,879,880],{},"needs_reauth",[110,882,883,885,896],{},[127,884,857],{},[127,886,887,408,890,408,893],{},[18,888,889],{},"post_not_editable",[18,891,892],{},"post_not_publishable",[18,894,895],{},"post_not_retryable",[127,897,898],{},"The post is in the wrong status for this call.",[110,900,901,903,908],{},[127,902,857],{},[127,904,905],{},[18,906,907],{},"post_processing",[127,909,910],{},"The post is being published right now. Try again in a minute.",[110,912,913,915,926],{},[127,914,857],{},[127,916,917,408,920,408,923],{},[18,918,919],{},"not_published",[18,921,922],{},"nothing_to_delete",[18,924,925],{},"nothing_to_retry",[127,927,928],{},"No targets match the call.",[110,930,931,933,938],{},[127,932,857],{},[127,934,935],{},[18,936,937],{},"idempotency_in_progress",[127,939,940],{},"A request with this Idempotency-Key is still running.",[110,942,943,946,950],{},[127,944,945],{},"410",[127,947,948],{},[18,949,862],{},[127,951,952],{},"Analytics for a disconnected account.",[110,954,955,957,961],{},[127,956,477],{},[127,958,959],{},[18,960,671],{},[127,962,963,964,966],{},"The content breaks a platform rule. ",[18,965,663],{}," lists the issues per platform.",[110,968,969,971,976],{},[127,970,477],{},[127,972,973],{},[18,974,975],{},"idempotency_conflict",[127,977,978],{},"The Idempotency-Key was used with a different request.",[110,980,981,983,991],{},[127,982,477],{},[127,984,985,408,988],{},[18,986,987],{},"account_user_mismatch",[18,989,990],{},"multiple_users",[127,992,993],{},"The accounts belong to another user, or to more than one.",[110,995,996,998,1006],{},[127,997,477],{},[127,999,1000,408,1003],{},[18,1001,1002],{},"no_queue_schedule",[18,1004,1005],{},"queue_full",[127,1007,1008,1011],{},[18,1009,1010],{},"queue: true"," without a schedule, or no free slot in 8 weeks.",[110,1013,1014,1016,1023],{},[127,1015,477],{},[127,1017,1018,408,1020],{},[18,1019,729],{},[18,1021,1022],{},"media_error",[127,1024,1025],{},"The platform rejected the content or couldn't fetch the media.",[110,1027,1028,1031,1036],{},[127,1029,1030],{},"429",[127,1032,1033],{},[18,1034,1035],{},"rate_limited",[127,1037,1038],{},"Over 300 requests a minute for this key, or the platform's own limit.",[110,1040,1041,1044,1049],{},[127,1042,1043],{},"500",[127,1045,1046],{},[18,1047,1048],{},"internal_error",[127,1050,1051,1052,1055],{},"Something went wrong on our side. Check whether the work was done (for example with ",[18,1053,1054],{},"GET \u002Fposts",") before retrying with a new Idempotency-Key.",[110,1057,1058,1061,1069],{},[127,1059,1060],{},"502",[127,1062,1063,408,1066],{},[18,1064,1065],{},"platform_error",[18,1067,1068],{},"network",[127,1070,1071],{},"The platform failed or couldn't be reached. Retry later.",[14,1073,1074,1075,1078,1079,77],{},"Errors from publishing itself are not HTTP errors: a post that fails on one platform still returns ",[18,1076,1077],{},"201",", with the error on that ",[95,1080,1082],{"href":1081},"\u002Fdocs\u002Fpublishing#statuses","target",[62,1084,1086],{"id":1085},"old-error-fields","Old error fields",[14,1088,1089,1090,442,1093,1096],{},"The first version of the API returned only ",[18,1091,1092],{},"statusCode",[18,1094,1095],{},"statusMessage",". Both are still in every error, so older clients keep working.",[1098,1099,1100],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}",{"title":32,"searchDepth":54,"depth":54,"links":1102},[1103,1104,1105,1106,1107,1110],{"id":64,"depth":54,"text":65},{"id":101,"depth":54,"text":102},{"id":219,"depth":54,"text":220},{"id":306,"depth":54,"text":307},{"id":449,"depth":54,"text":450,"children":1108},[1109],{"id":675,"depth":346,"text":676},{"id":1085,"depth":54,"text":1086},"Authenticate Connect API requests with live and test API keys, stay within 300 requests per minute, retry safely with Idempotency-Key, and handle error codes.","md",{},true,"\u002Fdocs\u002Fauthentication",{"title":5,"description":1111},"Authentication, Rate Limits and Errors – Connect API","docs\u002Fauthentication","yHNikshMLczdx5dJInHzPkU4RGwnwmg6AgORUCNF1tQ",1794240385868]