PageSourceSearch

https://www.obico.io/assets/js/62f38716.68840cf0.js

js obico.io collected 2026-10-03 22:56:18 UTC 10,259 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkobico_docs=globalThis.webpackChunkobico_docs||[]).push([[13656],{18759:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>a,contentTitle:()=>r,default:()=>h,frontMatter:()=>c,metadata:()=>o,toc:()=>d});const o=JSON.parse('{"id":"elegoo-apis/elegoo-obico-user-access-token","title":"Elegoo-Obico User Access Token API","description":"The APIs documented on this page are designed for Elegoo partners to manage user-based access tokens for their custom authentication system.","source":"@site/docs/elegoo-apis/elegoo-obico-user-access-token.md","sourceDirName":"elegoo-apis","slug":"/elegoo-apis/elegoo-obico-user-access-token","permalink":"/docs/elegoo-apis/elegoo-obico-user-access-token","draft":false,"unlisted":true,"editUrl":"https://github.com/TheSpaghettiDetective/TheSpaghettiDetective/edit/master/website/docs/elegoo-apis/elegoo-obico-user-access-token.md","tags":[],"version":"current","frontMatter":{"title":"Elegoo-Obico User Access Token API","unlisted":true}}');var t=s(74848),i=s(28453);const c={title:"Elegoo-Obico User Access Token API",unlisted:!0},r=void 0,a={},d=[{value:"Authentication",id:"authentication",level:2},{value:"Endpoint",id:"endpoint",level:2},{value:"POST <code>/ent/partners/api/elegoo/user_access_token/</code>",id:"post-entpartnersapielegoouser-access-token",level:2},{value:"Request",id:"request",level:3},{value:"Body parameters",id:"body-parameters",level:4},{value:"Example request",id:"example-request",level:4},{value:"Response",id:"response",level:3},{value:"Status code: <code>201</code>",id:"status-code-201",level:4},{value:"Body",id:"body",level:4},{value:"Status code: <code>200</code>",id:"status-code-200",level:4},{value:"Body",id:"body-2",level:4},{value:"Status code: <code>400</code>",id:"status-code-400",level:4},{value:"Body",id:"body-1",level:4},{value:"Status code: <code>401</code>",id:"status-code-401",level:4},{value:"Body",id:"body-3",level:4},{value:"Usage Examples",id:"usage-examples",level:2},{value:"Creating a new access token",id:"creating-a-new-access-token",level:3},{value:"Updating an existing access token",id:"updating-an-existing-access-token",level:3}];function l(e){const n={admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.p,{children:"The APIs documented on this page are designed for Elegoo partners to manage user-based access tokens for their custom authentication system."}),"\n",(0,t.jsx)(n.h2,{id:"authentication",children:"Authentication"}),"\n",(0,t.jsx)(n.p,{children:"All APIs are authenticated by the partner's authentication token in the HTTP request header:"}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.code,{children:"Authorization: Token XXX"})}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsx)(n.p,{children:"Please contact Obico team to obtain your partner authentication token."})}),"\n",(0,t.jsx)(n.h2,{id:"endpoint",children:"Endpoint"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"https://elegoo-app.obico.io/"}),". Production endpoint. Please use this endpoint unless instructed by the Obico team differently."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"https://elegoo-app-stg.obico.io/"}),". Staging endpoint. Please don't use unless instructed by the Obico team."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"https://elegoo-cn-app.elegoo.com.cn"}),". Production endpoint within China."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"https://elegoo-cn-app-stg.elegoo.com.cn"}),". Staging endpoint within China."]}),"\n"]}),"\n",(0,t.jsxs)(n.h2,{id:"post-entpartnersapielegoouser-access-token",children:["POST ",(0,t.jsx)(n.code,{children:"/ent/partners/api/elegoo/user_access_token/"})]}),"\n",(0,t.jsxs)(n.p,{children:["Creates a new Elegoo user access token record, or updates an existing one if a record with the same ",(0,t.jsx)(n.code,{children:"elegoo_user_id"})," already exists."]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:['This endpoint performs an "upsert" operation - it will create a new record if the ',(0,t.jsx)(n.code,{children:"elegoo_user_id"}
1)," doesn't exist, or update the existing record if it does. This allows you to use a single endpoint for both creating and refreshing access tokens."]})}),"\n",(0,t.jsx)(n.h3,{id:"request",children:"Request"}),"\n",(0,t.jsxs)(n.p,{children:["This POST request should be sent as ",(0,t.jsx)(n.code,{children:"application/json"})," format."]}),"\n",(0,t.jsx)(n.h4,{id:"body-parameters",children:"Body parameters"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"elegoo_user_id"})," (required): A unique identifier for the Elegoo user. Max 256 characters."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"access_token"})," (required): The access token for the user. Max 512 characters."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"expire_in"})," (required): Number of seconds from now until the token expires. Server computes ",(0,t.jsx)(n.code,{children:"expired_at"}),"."]}),"\n"]}),"\n",(0,t.jsx)(n.h4,{id:"example-request",children:"Example request"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n  "elegoo_user_id": "ELEGOO_USER_001",\n  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",\n  "expire_in": 86400\n}\n'})}),"\n",(0,t.jsx)(n.h3,{id:"response",children:"Response"}),"\n",(0,t.jsxs)(n.h4,{id:"status-code-201",children:["Status code: ",(0,t.jsx)(n.code,{children:"201"})]}),"\n",(0,t.jsx)(n.p,{children:"A new access token record was created successfully."}),"\n",(0,t.jsx)(n.h4,{id:"body",children:"Body"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n  "code": 201,\n  "msg": "success"\n}\n'})}),"\n",(0,t.jsxs)(n.h4,{id:"status-code-200",children:["Status code: ",(0,t.jsx)(n.code,{children:"200"})]}),"\n",(0,t.jsx)(n.p,{children:"An existing access token record was updated successfully."}),"\n",(0,t.jsx)(n.h4,{id:"body-2",children:"Body"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n  "code": 200,\n  "msg": "success"\n}\n'})}),"\n",(0,t.jsxs)(n.h4,{id:"status-code-400",children:["Status code: ",(0,t.jsx)(n.code,{children:"400"})]}),"\n",(0,t.jsx)(n.p,{children:"API request was NOT processed successfully due to missing required parameters or invalid data format."}),"\n",(0,t.jsx)(n.h4,{id:"body-1",children:"Body"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n  "error": "elegoo_user_id, access_token, and expire_in are required"\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n  "error": "expire_in must be an integer number of seconds"\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"or"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n  "error": "expire_in must be > 0 seconds"\n}\n'})}),"\n",(0,t.jsxs)(n.h4,{id:"status-code-401",children:["Status code: ",(0,t.jsx)(n.code,{children:"401"})]}),"\n",(0,t.jsx)(n.p,{children:"Partner authentication token is not valid. Contact Obico team member."}),"\n",(0,t.jsx)(n.h4,{id:"body-3",children:"Body"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n  "error": "Invalid or Inactive Token",\n  "is_authenticated": "False"\n}\n'})}),"\n",(0,t.jsx)(n.h2,{id:"usage-examples",children:"Usage Examples"}),"\n",(0,t.jsx)(n.h3,{id:"creating-a-new-access-token",children:"Creating a new access token"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:'curl -X POST https://elegoo-app.obico.io/ent/partners/api/elegoo/user_access_token/ \\\n  -H "Content-Type: application/json" \\\n  -H "Authorization: Token YOUR_PARTNER_TOKEN" \\\n  -d \'{\n    "elegoo_user_id": "ELEGOO_USER_001",\n    "access_token": "your_access_token_here",\n    "expire_in": 86400\n  }\'\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response (201 Created):"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n  "code": 201,\n  "msg": "success"\n}\n'})}),"\n",(0,t.jsx)(n.h3,{id:"updating-an-existing-access-token",children:"Updating an existing access token"}),"\n",(0,t.jsxs)(n.p,{children:["To update an existing access token, simply send the same POST request with the same ",(0,t.jsx)(n.code,{children:"elegoo_user_id"})," but with new ",(0,t.jsx)(n.code,{children:"access_token"})," and/or ",(0,t.jsx)(n.code,{children:"expire_in"})," values:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:'curl -X POST https://elegoo-app.obico.io/ent/partners/api/elegoo/user_access_token/ \\\n  -H "Content-Type: application/json" \\\n  -H "Authorization: Token YOUR_PARTNER_TOKEN" \\\n  -d \'{\n    "elegoo_user_id": "ELEGOO_USER_001",\n    "access_token": "new_updated_token",\n    "expire_in": 172800\n  }\'\n'})}
1),"\n",(0,t.jsx)(n.p,{children:"Response (200 OK):"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n  "code": 200,\n  "msg": "success"\n}\n'})}),"\n",(0,t.jsx)(n.admonition,{type:"note",children:(0,t.jsxs)(n.p,{children:["The endpoint automatically determines whether to create or update based on whether the ",(0,t.jsx)(n.code,{children:"elegoo_user_id"})," already exists. You can use the same POST request for both operations - the response status code will indicate whether a new record was created (201) or an existing one was updated (200)."]})})]})}function h(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},28453:(e,n,s)=>{s.d(n,{R:()=>c,x:()=>r});var o=s(96540);const t={},i=o.createContext(t);function c(e){const n=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:c(e.components),o.createElement(i.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.