POST /oauth/convert

Required authentication: Application
Supported formats: json

Exchanges an OAuth code for a full OAuth grant object. The returned object will contain the grant_secret that you should use for future requests inside the Authorization header for that account.

Each code expires in 5 minutes, and can only be used once. Repeated requests sent to this method with the same code will fail.

Ensure that you save both the grant_id and the grant_secret you receive, as well as recording any other data in the object that your application needs to run, such as the information inside the account object.

Parameter Type Atn Details
code String The grant code from the previous step in the OAuth workflow.

Example Requests

Exchange an OAuth code for a grant object:

Content-Type: application/json
Authorization: Bearer cs-ExampleSecret

  "code": "gc-ENzlRAvVms3XCMdc0ENhz2VNwlgiih5I"
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8

  "object": "oauth_grant",
  "grant_id": "113444e0-d60f-44c4-8643-c0ccfc3d221f",
  "created_at": "2022-06-26T10:56:50-04:00",
  "scope": "read",
  "grant_secret": "gs-Njv5iBctpAGeCP1SaKeQN5Wrzz1Dr8lw",
  "revoked": false,
  "account": {
    "object": "scryfall_account",
    "id": "94e87a72-0e4a-49f6-9317-d9600355d403",
    "username": "amoeboi",
    "display_name": "Amoeboid Changeling",
    "twitter": "wizards_magic",
    "verified": false,
    "supporter": false