Pixlr提供了一个API,使第三方开发人员能够将Pixlr强大的编辑功能集成到他们自己的应用程序中,从而形成一个充满活力的创意工具和解决方案生态系统。
A JWT token is used to authenticate and authorize the client to use the Pixlr API.
The token gets passed to the Pixlr Applications using the 'token' query parameter on any of the Application pages.
(ex: https://pixlr.com/editor/?token=eyJhbGc...gYAUKKg).
The JWT is signed using your Pixlr API secret. Using any of these algorithms:
RS256, RS384, RS512, PS256, PS384, PS512, ES256, ES256K, ES384, ES512, EdDSA, HS256, HS384, HS512
JWT tokens should only be generated on the server-side to avoid leaking credentials!
These are the properties and values that goes directly into the JWT payload.
Property | Type | Required | Description |
---|---|---|---|
sub | string | yes | JWT subject, use your Pixlr API key in the sub field |
mode | http embedded | yes | Which API mode you are operating in |
origin | string | yes - in embedded mode |
Specifiy the name of your application (ex: https://yourdomain.com). This should be the base domain from where you will use the API. We do this to make sure the Pixlr Applications only responds to messages coming from the right place. |
openUrl | string | yes - in http mode | In http mode, specify a URL where the Pixlr Application will fetch and open an image on startup. |
saveUrl | string | yes - in http mode | In http mode, specify where the Pixlr Applications will send a HTTP POST with the saved image. |
follow | boolean | no |
If this is enabled the Application window will POST to the saveUrl
using a standard FORM, so the entire window will navigate to the saveUrl location. If this is disabled the Application will POST using XHR so that the Application window remains intact. follow defaults to true |
settings | Settings | no | Settings to apply to Pixlr Applications |
Settings are used to change the behaviour, theme of the Pixlr Applications.
These are only in app settings and does not alter the behaviour of the API.
These settings can also be configured on a per api key basis under the Developer tab in My Account.
Settings added to the token will override any pre-configured value.
This enables you to have a pre-configured set of base settings and with the ability to override as needed.
Property | Type | Description |
---|---|---|
referrer | string | Name of the Application using the API, this is shown in the Pixlr Applications |
icon | string | URL to an icon for your Application that is shown in the Pixlr Applications |
accent | string | Accent color. Allowed values are ash, brown, coral, pink, rose, red, plum, maroon, purple, lavender, denim, blue, teal, green, lime, mustard' |
workspace | string | Workspace color (background color). Allowed values are dark, iron, steel, light |
tabLimit | number | The maximum number of tabs a user can have open at once |
blockOpen | boolean | Weather the Pixlr Application should block users from opening images from other sources than the API |
exportFormats | string [ ] | Array of export formats that are allowed to be exported. Passing multiple formats will export multiple files in the respective formats. Allowed formats are png, jpeg, webp, pxz, pdf |
disabledTools | string [ ] | Array of tools that should be disabled in the Pixlr Applications. Allowed tools are crop, resize, rotate, adjust, filter, ai, effect, overlay, border, type, liquify, heal, denoise, smooth, sharpen, blur, clone, red-eye, draw, erase, gradient, fill, colorpicker, zoom, hand, move, select, transform, shape, text, brush, pencil, line, rectangle, ellipse, polygon, star, arrow, callout, sticker, frame, border, mask, crop, resize, rotate, flip, skew, perspective, warp, liquify, heal, denoise, smooth, sharpen, blur, clone, red-eye, draw, erase, gradient, fill, colorpicker, zoom, hand, move, select, transform, shape, text, brush, pencil, line, rectangle, ellipse, polygon, star, arrow, callout, sticker, frame, border, mask |