Skip to content

Latest commit

 

History

History
793 lines (659 loc) · 23.6 KB

12-licensing-reference.md

File metadata and controls

793 lines (659 loc) · 23.6 KB

Licensing reference

Content and Member requests

The Stock API provides the following methods related to licensing and getting more info about licensed assets. For a guide to usage and additional examples, see Licensing Stock assets.

Endpoints Method
https://stock.adobe.io/Rest/Libraries/1/Content/Info GET
https://stock.adobe.io/Rest/Libraries/1/Content/License GET, POST (for adding license references)
https://stock.adobe.io/Rest/Libraries/1/Member/Profile GET
https://stock.adobe.io/Rest/Libraries/1/Member/LicenseHistory GET
  • Content/Info. Requests licensing information about a specific asset for a specific user or enterprise organization.

  • Content/License. Requests a license for an asset.

  • Member/Profile. Asks for the licensing capabilities for a specific user or organization. Call this before requesting an asset license so that you can display the user's existing quota or direct the user to the Adobe Stock site to purchase a plan or asset.

    This API returns the user's available purchase quota and information that you can use to present licensing options to the user when the user next requests an asset purchase. Depending on the user's quota and plan the following cases can occur:

    • User has enough quota to license the next asset. Display the returned message, which shows the user's current quota before purchasing.
    • User doesn't have enough quota but can handle overage (they have a saved purchase method on file). Display the returned message, which includes the price and asks the user to license the asset with overage.
    • User doesn't have quota and there is no overage plan. Display the returned message, which indicates that the user will be redirect to the Adobe Stock site to review plans.
  • Member/LicenseHistory. This is covered in the next section, License history reference.

Authentication

The Authorization header is required for any of the licensing calls. The API uses the header to determine the user's member number, licensing status, and default locale. See API authentication for more information.

Request headers

See Headers for Stock API calls for details about header content.

  • Required headers: x-Product, x-api-key, Authorization
  • Optional headers: X-Request-Id

URL parameters

Pass URL-encoded parameters with the GET request.

Parameter Description
content_id Asset's unique identifier. You can get this from a search response's id attribute. Integer.
license Use only with Content/Info, Content/License, and Member/Profile. The Adobe Stock licensing state for the asset. String.

Valid values and meaning:

  • "" (empty string): No license applies
  • For standard/core photos, illustrations, and vectors (non-Premium):
    • Standard: License for the full-resolution image
    • Extended: Extended license for the full-resolution image
  • For video:
    • Video_HD: License for the HD-resolution video
    • Video_4K: License for the 4K-resolution video. Tip: Not all videos are available in 4K.
  • For vector assets: Standard or Extended
  • For 3D assets: Standard
  • For templates: Standard
  • For Premium:
    • Standard: License for the full-resolution image
    • Standard_M: License for a medium-size asset approximately 1600x1200 pixels. Tip: Not all Premium assets offer this license.
    • Extended: Extended license for the full-resolution image
locale Use with Member/Profile and Member/LicenseHistory.

Optional. Location language code for the API to use when returning localized messages. The API can usually get the user's default locale through the Authorization header. This value overrides that or provides a locale if not available through Authorization. String.

Default is en_US. See the full list of Locales.

license_again Use with Content/License.

Optional. Used to re-license an asset, deducting licenses/credits as if it were a new transaction. Boolean.

Default is false, meaning that if Content/License is used on an asset that is already licensed, it will not trigger a new license. Using true overrides that behavior, and forces a new license event.

  curl "https://stock.adobe.io/Rest/Libraries/1/Content/License?content_id=112670342&license=Standard&license_again=true" \
    -H "x-api-key: YourApiKeyHere" \
    -H "x-product: MySampleApp/1.0" \
    -H "authorization: Bearer AccessTokenHere"

Responses

Calls return information in JSON structures.

Response JSON summaries

  • Content/Info returns this structure. Some attributes appear only in certain situations.
{"contents": {
    "0000": {
      "content_id": 0000,
      "purchase_details": {
        "stock_id": 12345,  (only if user has not purchased)
        "date": "yyyy-mm-dd hh:mm:mm", (only if purchased)
        "license": "...", (only if purchased)
        "state": "..."
      },
      "size": "..."
    }
  },
  "member": { "stock_id": 12345 }
}
  • Content/License returns this structure. Some attributes appear only in certain situations.
{ "available_entitlement": { 
    "quota": n, 
    "license_type_id": x,
    "has_credit_model": true||false,
    "has_agency_model": true||false,
    "is_cce": true||false,    
    "full_entitlement_quota": [] 
  },
  "contents": {
    "0000": {
      "content_id": 0000,
      "purchase_details": {
        "state": "...",
        "license": "...",
        "date": "yyyy-mm-dd hh:mm:mm", (only if licensed)
        "url": "...",     (only if download needed)
        "content_type": "...",
        "width": 000,
        "height": 000,
        (additional props depending on asset type...)
      },
      "size": "..."
    }
  },
  "member": { "member_id": 12345 }
 }
  • Member/Profile returns this structure. Some attributes appear only in certain situations.
{ "available_entitlement": { 
    "quota": n, 
    "license_type_id": x,
    "has_credit_model": true||false,
    "has_agency_model": true||false,
    "is_cce": true||false,    
    "full_entitlement_quota": [] 
  },
  "purchase_options": {
    "state": "...",
    "requires_checkout": ....,
    "message": "...",
    "url": "..."   (only if user has no quota or overage)
  },
  "member": { "member_id": 12345 } (only if user has quota or overage)
}

Response attributes

Name Description
available_entitlement{...} Information about licenses available for this user. Structure.
available_entitlement:
    quota
Quantity of licenses/credits remaining available for this user for this asset type. Integer.
available_entitlement:
    license_type_id
License type of combined asset and license. Integer.
available_entitlement:
    has_credit_model
(Enterprise only) Type of enterprise contract model. Boolean.
available_entitlement:
    has_agency_model
(Enterprise only) Type of enterprise contract model. Boolean.
available_entitlement:
    is_cce
Whether this is an enterprise entitlement or not. Boolean.
available_entitlement:
    full_entitlement_quota
Licensing quota types available. This information is subject to change as new license types are added and subtracted; best practice is to use the main available_entitlement.quota value instead. Array.
contents{...} Licensing information for this asset for this user. Structure.

The number directly inside contents is the same asset ID number that is returned in content_id:

"contents": {
    "nnnnn": {
        "content_id": nnnnn, 
        ...
    }, ...
}
contents:
    content_id
Asset's unique identifier. String.
contents:
    purchase_details{...}
Information about the user's purchase/license of this asset. Structure.
contents:
  purchase_details:
    state
User's purchase relationship to an asset.

Possible values and meanings:

  • not_purchased: User has not at any time in the past purchased the asset.
  • purchased : User has at some time in the past purchased the asset.
  • cancelled: User attempted to buy the asset and for some reason the order did not go through.
  • not_possible: User must go to the Adobe Stock site to buy plan or asset.
  • just_purchased: User bought asset within the current session.
  • overage: Adobe Stock has a payment instrument on file for the user and can bill the user for additional purchases. Does not apply to enterprise as it is always possible to add additional licenses.
contents:
  purchase_details:
    license
Type of license that the user has for this asset. String.

For possible values, see URL parameters, above.

contents:
  purchase_details:
    date
Date when the asset was purchased or licensed. Date format.
contents:
  purchase_details:
    url
The URL from which the licensed asset can be downloaded. String.
contents:
  purchase_details:
    content_type
Mime type of asset. String.
contents:
  purchase_details:
    width/height/...
Dimensions and other physical properties of asset. Mixed types.
contents:
    size
The size of the asset, indicating whether it is the free complementary size or the original full-sized asset. String.

Possible values:

  • Comp
  • Original
purchase_options {...} Information about the user's purchasing options for this asset. Structure.
member {...} Information about the user; for Adobe Stock internal use.
purchase_options:
    requires_checkout
Whether a purchase in process requires going to the Adobe Stock site for completion. Returns true or false. Boolean.
purchase_options:
    message

Message to display to your user in response to a Licensing API query. String.

All returned messages are localized and generated for you by the Stock API. This provides uniform messaging for all clients of Stock API.

purchase_options:
    state
User's purchase relationship to an asset. See contents.purchase_details.state above. String.
purchase_options:
    url
Only displayed if user is not able to license asset. URL directs user to Adobe Stock site to get plan. String.

Examples

Content/Info

Asset not purchased by this user

GET /Rest/Libraries/1/Content/Info?content_id=59741022 HTTP/1.1
Host: stock.adobe.io
X-Product: MySampleApp/1.0
x-api-key: MyApiKey
Authorization: Bearer MyAccessToken
{
  "contents": {
    "59741022": {
      "content_id": 59741022,
      "purchase_details": {
        "member_id": 23456,
        "state": "not_purchased"
      },
      "size": "Comp"
    }
  },
  "member": {
    "member_id": 23456
  }
}

Asset purchased by this user with Extended license

GET /Rest/Libraries/1/Content/Info?content_id=62047262&license=Extended HTTP/1.1
Host: stock.adobe.io
X-Product: MySampleApp/1.0
x-api-key: MyApiKey
Authorization: Bearer MyAccessToken
{
  "contents": {
    "62047262": {
      "content_id": 62047262,
      "purchase_details": {
        "date": "2015-02-10 15:00:00",
        "license": "Extended",
        "state": "purchased"
      },
      "size": "Original"
    }
  },
  "member": {
    "member_id": 23456
  }
}

Content/License

Just-licensed asset with existing quota

Download from the purchase_details.url and indicate how many purchasing options remain for the user. You can download the asset again without using any quota or making a purchase.

GET /Rest/Libraries/1/Content/License?content_id=62305369&license=Standard HTTP/1.1
Host: stock.adobe.io
X-Product: MySampleApp/1.0
x-api-key: MyApiKey
Authorization: Bearer MyAccessToken
{
  "available_entitlement": {
    "quota": 48,
    "license_type_id": 42,
    "has_credit_model": false,
    "has_agency_model": true,
    "is_cce": true,
    "full_entitlement_quota": {
      "image_quota": 48
    }
  },
  "contents": {
    "62305369": {
      "content_id": "62305369",
      "size": "Comp",
      "purchase_details": {
        "state": "just_purchased",
        "license": "Standard",
        "date": "2017-11-01 22:57:48",
        "url": "https://stock.adobe.com/Rest/Libraries/Download/62305369/1",
        "content_type": "image/jpeg",
        "width": 3333,
        "height": 2222
      }
    }
  }
}

Using license references in license request

If your enterprise account is configured to require or allow optional license references, then the Content/License request must be made a POST, adding the references as JSON in the body of the message. Additionally, the Content-Type of the request should be application/json.

POST /Rest/Libraries/1/Content/License?content_id=88744241&license=Standard HTTP/1.1
Host: stock.adobe.io
Content-Type: application/json
X-Product: MySampleApp/1.0
x-api-key: MyApiKey
Authorization: Bearer MyAccessToken

{
  "cce_agency": [
    { "id": "3", "value": "AcmePillows" },
    { "id": "4", "value": "123456789" }
  ]
}

JSON response is identical to response for a normal GET Content/License request.

Member/Profile

User has quota

GET /Rest/Libraries/1/Member/Profile?content_id=112670342&license=Standard HTTP/1.1
Host: stock.adobe.io
X-Product: MySampleApp/1.0
x-api-key: MyApiKey
Authorization: Bearer MyAccessToken
{
  "available_entitlement": {
    "quota": 48,
    "license_type_id": 1,
    "has_credit_model": false,
    "has_agency_model": false,
    "is_cce": false,
    "full_entitlement_quota": {
      "image_quota": 48
    }
  },
  "member": {
    "stock_id": 1272100
  },
  "purchase_options": {
    "state": "possible",
    "requires_checkout": false,
    "message": "This will use 1 of your 48 licenses."
  }
}

User has no quota but has an overage plan

GET /Rest/Libraries/1/Member/Profile?content_id=64285595&license=Standard HTTP/1.1
Host: stock.adobe.io
X-Product: MySampleApp/1.0
x-api-key: MyApiKey
Authorization: Bearer MyAccessToken
{
  "available_entitlement": {
    "quota": 0,
    "license_type_id": 1,
    "has_credit_model": false,
    "has_agency_model": false,
    "is_cce": false,
    "full_entitlement_quota": {
      "image_quota": 0
    }    
  },
  "purchase_options": {
    "state": "overage",
    "requires_checkout": false,
    "message": "Would you like to license the image for $2.99?"
  },
  "member": {
    "member_id": 34567
  }
}

User has no quota or overage plan

GET /Rest/Libraries/1/Member/Profile?locale=en_US&content_id=64285595 HTTP/1.1
Host: stock.adobe.io
X-Product: MySampleApp/1.0
x-api-key: MyApiKey
Authorization: Bearer MyAccessToken
{
  "available_entitlement": {
    "quota": 0,
    "full_entitlement_quota": {
      "image_quota": 0
    } 
  },
  "purchase_options": {
  "state": "not_possible",
  "requires_checkout": true,
  "message": "Would you like to see purchase options?",
  "url": "http://stock.adobe.io/plans?image_id=64285595"
  }
}

Error codes

Each error generates a JSON array that contains the following keys and values. If your application receives this array and you need assistance, send the array to Adobe.

  • An error key.
  • Optionally, a code key. Specifies an integer designating the category of error. Code values:
    • 10: Invalid access token. The access token that you passed is invalid or expired.
    • 11: Invalid API Key. The API key that you passed is not valid or has expired.
    • 20: Invalid parameters. The URL parameters that you passed are not supported.
    • 31: Invalid Method. The method that you specified does not exist in the method list.
    • 100: Invalid data. Data that you specified as arguments are not supported.

Downloading licensed files

The Content/License method returns a download URL, which uses the Libraries/Download endpoint. This URL can be accessed via a normal GET request over an HTTPS connection.

Endpoint Method
https://stock.adobe.io/Rest/Libraries/Download/{id}/1 GET

In the URL above, the {id} value must be substituted with the Adobe Stock ID attribute.

Authentication

Unlike other Stock API license methods, Download does not use request headers for authentication; using an authentication header can break the download URL. Instead, the access token needs to be sent via a URL parameter.

Request headers

None (see above).

URL parameters

Parameter Description
token

Valid access token. String. Required, used in place of the Authorization: Bearer {token} authentication header.

The token does not need to be the same one used to license the asset as long as it is from the same user or enterprise entitlement.

size

Optional, requested image size. Integer. Only valid for bitmap/image assets and videos only (e.g., does not apply to template, vector, or 3D assets.)

If command is not present, file returned will be full/original size. Valid values:

  • 5000: 5000px or original size image
  • 3100: 3100-4999px image
  • 2400: 2400-3099px image
  • 1600: 1600-2399px image
  • 800: 800-1599px image
  • 400: 799px or smaller image
  • 2160*: Full/original 4K video
  • 1080*: HD 1080 video

* Only applies to video.

Response

A valid response will trigger a file download, otherwise, an error will be returned. Downloads will typically consist of a 302 redirect which points to a signed URL.

Examples

In the following examples, "MyAccessToken" would be substituted with a valid access token generated by your application. When using curl, be sure to include the "follow redirects" option (-L on the command line.)

Download of original asset

curl -L "https://stock.adobe.com/Rest/Libraries/Download/62305369/1?token=MyAccessToken" > "AdobeStock_62305369.jpeg"

Download of 1600px image

curl -L "https://stock.adobe.com/Rest/Libraries/Download/62305369/1?token=MyAccessToken&size=1600" > "AdobeStock_62305369-1600.jpeg"

Download of 1080p rendition of video

curl -L "https://stock.adobe.com/Rest/Libraries/Download/99872034/1?token=MyAccessToken&size=1080" > "AdobeStock_99872034-1080.mp4"

Download errors

  • "This download cannot be processed, invalid size": Size command must be one of the values listed above, and file must be an image or video asset.
  • "This download is expired": Token has expired
  • "Cannot find a download for this file and license on this organization": Invalid access token, or generated for wrong user/account, or asset is not actually licensed. Use Content/Info or Member/Profile for more information.

More information