The Gumroad OAuth API is based around REST. We return JSON for every request, including errors.
To start using the API, you'll need to register your OAuth application. Note: The Verify License API endpoint does not require an OAuth application.
After creating an application, you'll be given a unique application id and application secret.
Authentication
On the application page, click Generate access token to get the token you will use with the API.
Scopes
We've provided five scopes that you may request when the user authorizes your application.
edit_products: read/write access to the user's products and their variants, offer codes, and custom fields.
view_sales: read access to the user's products' sales information, including sales counts. This scope is also required in order to subscribe to the user's sales.
mark_sales_as_shipped: write access to mark the user's products' sales as shipped.
refund_sales: write access to refund the user's products' sales.
Resources
Create an OAuth application - A getting started guide for creating an application with our API.
omniauth-gumroad - (Ruby) an OmniAuth strategy for Gumroad OAuth.
More reading
If you're interested in learning more about OAuth, here are some links that might be useful:
API Errors
Gumroad uses HTTP status codes to indicate the status of a request. Here's a run down on likely response codes.
200 OK
everything worked as expected.
400 Bad Request
you probably missed a required parameter.
401 Unauthorized
you did not provide a valid access token.
402 Request Failed
the parameters were valid but request failed.
404 Not Found
the requested item doesn't exist.
500, 502, 503, 504 Server Error
something else went wrong on our end.
To help you further, we provide a JSON object that goes more in-depth about the problem that led to the failed request. Errors responses from the api will follow the following format.
When present, the message will describe the particular problem and suggestions on what went wrong.
API Methods
Gumroad's OAuth 2.0 API lets you see information about your products, as well as you can add, edit, and delete offer codes, variants, and custom fields. Finally, you can see a user's public information and subscribe to be notified of their sales.
Products
GET /products
Retrieve all of the existing products for the authenticated user.
GET /products/:id
Retrieve the details of a product.
DELETE /products/:id
Permanently delete a product.
PUT /products/:id/enable
Enable an existing product.
PUT /products/:id/disable
Disable an existing product.
Variant categories
POST /products/:product_id/variant_categories
Create a new variant category on a product.
Parameters:
variant_categorytitle
GET /products/:product_id/variant_categories/:id
Retrieve the details of a variant category of a product.
PUT /products/:product_id/variant_categories/:id
Edit a variant category of an existing product.
Parameters:
variant_categorytitle
DELETE /products/:product_id/variant_categories/:id
Permanently delete a variant category of a product.
GET /products/:product_id/variant_categories
Retrieve all of the existing variant categories of a product.
POST /products/:product_id/variant_categories/:variant_category_id/variants
Create a new variant of a product.
Parameters:
variantname
price_difference_cents
max_purchase_count (optional)
GET /products/:product_id/variant_categories/:variant_category_id/variants/:id
Retrieve the details of a variant of a product.
PUT /products/:product_id/variant_categories/:variant_category_id/variants/:id
Edit a variant of an existing product.
Parameters:
variantname
price_difference_cents
max_purchase_count (optional)
DELETE /products/:product_id/variant_categories/:variant_category_id/variants/:id
Permanently delete a variant of a product.
GET /products/:product_id/variant_categories/:variant_category_id/variants
Retrieve all of the existing variants in a variant category.
Offer codes
GET /products/:product_id/offer_codes
Retrieve all of the existing offer codes for a product. Either amount_cents or percent_off will be returned depending if the offer code is a fixed amount off or a percentage off. A universal offer code is one that applies to all products.
GET /products/:product_id/offer_codes/:id
Retrieve the details of a specific offer code of a product
POST /products/:product_id/offer_codes
Create a new offer code for a product. Default offer code is in cents. A universal offer code is one that applies to all products.
Parameters:
name (the coupon code used at checkout)amount_off
offer_type (optional, "cents" or "percent") Default: "cents"
max_purchase_count (optional)
universal (optional, true or false) Default: false
PUT /products/:product_id/offer_codes/:id
Edit an existing product's offer code.
Parameters:
offer_codemax_purchase_count
DELETE /products/:product_id/offer_codes/:id
Permanently delete a product's offer code.
Custom fields
GET /products/:product_id/custom_fields
Retrieve all of the existing custom fields for a product.
POST /products/:product_id/custom_fields
Create a new custom field for a product.
Parameters:
variantname
required (true or false)
PUT /products/:product_id/custom_fields/:name
Edit an existing product's custom field.
Parameters:
variantrequired (true or false)
DELETE /products/:product_id/custom_fields/:name
Permanently delete a product's custom field.
User
GET /user
Retrieve the user's data.
Resource subscriptions
PUT /resource_subscriptions
Subscribe to a resource. Currently there are 8 supported resource names - "sale", "refund", "dispute", "dispute_won", "cancellation", "subscription_updated", "subscription_ended", and "subscription_restarted".
sale - When subscribed to this resource, you will be notified of the user's sales with an HTTP POST to your post_url. The format of the POST is described on the Gumroad Ping page.
refund - When subscribed to this resource, you will be notified of refunds to the user's sales with an HTTP POST to your post_url. The format of the POST is same as described on the Gumroad Ping page.
dispute - When subscribed to this resource, you will be notified of the disputes raised against user's sales with an HTTP POST to your post_url. The format of the POST is described on the Gumroad Ping page.
dispute_won - When subscribed to this resource, you will be notified of the sale disputes won by the user with an HTTP POST to your post_url. The format of the POST is described on the Gumroad Ping page.
cancellation - When subscribed to this resource, you will be notified of cancellations of the user's subscribers with an HTTP POST to your post_url.
subscription_updated - When subscribed to this resource, you will be notified when subscriptions to the user's products have been upgraded or downgraded with an HTTP POST to your post_url. A subscription is "upgraded" when the subscriber switches to an equally or more expensive tier and/or subscription duration. It is "downgraded" when the subscriber switches to a less expensive tier and/or subscription duration. In the case of a downgrade, this change will take effect at the end of the current billing period. (Note: This currently applies only to tiered membership products, not to all subscription products.)
subscription_ended - When subscribed to this resource, you will be notified when subscriptions to the user's products have ended with an HTTP POST to your post_url. These events include termination of a subscription due to: failed payment(s); cancellation; or a subscription of fixed duration ending. Notifications are sent at the time the subscription has officially ended, not, for example, at the time cancellation is requested.
subscription_restarted - When subscribed to this resource, you will be notified when subscriptions to the user's products have been restarted with an HTTP POST to your post_url. A subscription is "restarted" when the subscriber restarts their subscription after previously terminating it.
In each POST request, Gumroad sends these parameters:
subscription_id: id of the subscription
product_id: id of the product
product_name: name of the product
user_id: user id of the subscriber
user_email: email address of the subscriber
purchase_ids: array of charge ids belonging to this subscription
created_at: timestamp when subscription was created
charge_occurrence_count: number of charges made for this subscription
recurrence: subscription duration - monthly/quarterly/biannually/yearly/every_two_years
free_trial_ends_at: timestamp when free trial ends, if free trial is enabled for the membership
custom_fields: custom fields from the original purchase
license_key: license key from the original purchase
For "cancellation" resource:
cancelled: true if subscription has been cancelled, otherwise false
cancelled_at: timestamp at which subscription will be cancelled
cancelled_by_admin: true if subscription was been cancelled by admin, otherwise not present
cancelled_by_buyer: true if subscription was been cancelled by buyer, otherwise not present
cancelled_by_seller: true if subscription was been cancelled by seller, otherwise not present
cancelled_due_to_payment_failures: true if subscription was been cancelled automatically because of payment failure, otherwise not present
For "subscription_updated" resource:
type: "upgrade" or "downgrade"
effective_as_of: timestamp at which the change went or will go into effect
old_plan: tier, subscription duration, price, and quantity of the subscription before the change
new_plan: tier, subscription duration, price, and quantity of the subscription after the change
For "subscription_ended" resource:
ended_at: timestamp at which the subscription ended
ended_reason: the reason for the subscription ending ("cancelled", "failed_payment", or "fixed_subscription_period_ended")
For "subscription_restarted" resource:
restarted_at: timestamp at which the subscription was restarted
GET /resource_subscriptions
Show all active subscriptions of user for the input resource.
Parameters:
resource_name (string) - Currently there are 8 supported values - "sale", "refund", "dispute", "dispute_won", "cancellation", "subscription_updated", "subscription_ended", and "subscription_restarted".DELETE /resource_subscriptions/:resource_subscription_id
Unsubscribe from a resource.
Sales
GET /sales
Retrieves all of the successful sales by the authenticated user. Available with the 'view_sales' scope.
Parameters:
after (optional, date in form YYYY-MM-DD) - Only return sales after this datebefore (optional, date in form YYYY-MM-DD) - Only return sales before this date
product_id (optional) - Filter sales by this product
email (optional) - Filter sales by this email
order_id (optional) - Filter sales by this Order ID
page_key (optional) - A key representing a page of results. It is given in the response as `next_page_key`.
GET /sales/:id
Retrieves the details of a sale by this user. Available with the 'view_sales' scope.
PUT /sales/:id/mark_as_shipped
Marks a sale as shipped. Available with the 'mark_sales_as_shipped' scope.
Parameters:
tracking_url (optional)PUT /sales/:id/refund
Refunds a sale. Available with the 'refund_sales' scope.
Parameters:
amount_cents (optional) - Amount in cents (in currency of the sale) to be refunded. If set, issue partial refund by this amount. If not set, issue full refund. You can issue multiple partial refunds per sale until it is fully refunded.Subscribers
GET /products/:product_id/subscribers
Retrieves all of the active subscribers for one of the authenticated user's products. Available with the 'view_sales' scope
A subscription is terminated if any of failed_at, ended_at, or cancelled_at timestamps are populated and are in the past.
A subscription's status can be one of: alive, pending_cancellation, pending_failure, failed_payment, fixed_subscription_period_ended, cancelled.
Parameters:
email (optional) - Filter subscribers by this emailpaginated (optional, default: "false") - Set to "true" to limit the number of subscribers returned to 100.
page_key (optional) - A key representing a page of results. It is given in the paginated response of the previous page as `next_page_key`.
GET /subscribers/:id
Retrieves the details of a subscriber to this user's product. Available with the 'view_sales' scope.
Licenses
POST /licenses/verify
Verify a license
Parameters:
product_id (the unique ID of the product, available on product's edit page)license_key (the license key provided by your customer)
increment_uses_count ("true"/"false", optional, default: "true")
PUT /licenses/enable
Enable a license
Parameters:
product_id (the unique ID of the product, available on product's edit page)license_key (the license key provided by your customer)
PUT /licenses/disable
Disable a license
Parameters:
product_id (the unique ID of the product, available on product's edit page)license_key (the license key provided by your customer)
PUT /licenses/decrement_uses_count
Decrement the uses count of a license
Parameters:
product_id (the unique ID of the product, available on product's edit page)license_key (the license key provided by your customer)