Skip to content

Create your personal API key (refused on the public API)

Open .md

POST/v1/api/store/{team_slug}/user_api_key/create_api_key

v1Operation ID v1_public_user_api_key_create

Refused on the public API: once your key is accepted, it answers 403 with error code self_credential.

You need a key to call the API at all, so the first key is always created in the YoPrint web app, on your Profile page.

Business rules

  • The key is checked first, as on every operation: a missing or wrong key gets 401, and a key whose owner is not a member of the team gets 404. Any request that passes those checks gets 403 self_credential. Nothing is read, created or changed.
  • A personal API key cannot read, create or reset itself. If a key leaks, whoever holds it cannot lock you out by replacing it.

Path parameters

  • team_slugstringrequired

    Your team slug, shown as Team ID next to your API key in Profile.

    • Example your-team

Request body

This operation takes no request body.

Response

No success response is documented yet.

Errors

  • 401The API key is missing or wrong (unauthenticated).

    When
    The key is missing or wrong (unauthenticated).
    Fix
    Send a working key; check it with the sign-in check.
  • 403You are not allowed to do this. api_access_not_in_plan: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only {"message": "Insufficient Permission"}. Other refusals use the error envelope, with unauthorized or user_is_not_authorized.

    When
    Every request with a working key: {"status": 403, "success": false, "error": {"code": "self_credential", "message": "Manage your API key in YoPrint, not through the API."}}.
    Fix
    Manage the key on your Profile page in the YoPrint web app.
  • 404Not found. page_not_found: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's. code: null, with a message that starts "No query results for": there is no record with that id.

    When
    The key's owner is not a member of this team, or the team slug does not exist (page_not_found).
    Fix
    Use your own team's slug.

Notes

  • Manage your key in the YoPrint web app: open your Profile, then the API key section. There you can create the key, copy it, see when it was last used, and reset it. Resetting stops the old key at once.
  • To check that a key works, call GET /v1/api/store/{team_slug}/is_authenticated.