928ba265c2a7454a0edad907ae8f66d91ca72517
[arvados.git] / doc / user / reference / api-tokens.textile
1 ---
2 layout: default
3 navsection: userguide
4 navmenu: Reference
5 title: "Getting an API token"
6 navorder: 01
7 ---
8
9 h1. Reference: Getting an API token
10
11 The Arvados API token is a secret key that enables the @arv@ command line
12 client to access Arvados with the proper permissions.
13
14 Access the Arvados workbench using this link:
15
16 "https://workbench.{{ site.arvados_api_host }}/":https://workbench.{{ site.arvados_api_host }}/
17
18 (Replace @{{ site.arvados_api_host }}@ with the hostname of your local Arvados instance if necessary.)
19
20 Use the menu to navigate to _Access %(rarr)→% API Tokens._  There should be one or more rows.  The column *api_token* contains the actual token string that you will use.  Copy the value of *api_token* for the first row onto the clipboard.
21
22 Next, open a shell on the system on which you intend to use the Arvados client (refer to "Accessing Arvados over ssh":{{site.basedoc}}/user/getting_started/ssh-access.html ) and enter the following (replace the value of @ARVADOS_API_TOKEN@ with the value you copied from the Workbench):
23
24 bc. $ export ARVADOS_API_HOST={{ site.arvados_api_host }}
25 $ export ARVADOS_API_TOKEN=2jv9kd1o39t0pcfu7aueem7a1zjxhak73w90tzq3gx0es7j1ld
26
27 * @ARVADOS_API_HOST@ tells @arv@ which host to connect to
28 * @ARVADOS_API_TOKEN@ is the secret key used by the Arvados API server to authenticate access.
29
30 For your convenience, the "API Tokens" Workbench page provides a section at the top of the  page that you may copy and paste directly into the shell.  It will look something like this:
31
32 bc. ### Pasting the following lines at a shell prompt will allow Arvados SDKs
33 ### to authenticate to your account, youraddress@example.com
34 read ARVADOS_API_TOKEN <<EOF
35 2jv9kd1o39t0pcfu7aueem7a1zjxhak73w90tzq3gx0es7j1ld
36 EOF
37 export ARVADOS_API_TOKEN ARVADOS_API_HOST=qr1hi.arvadosapi.com
38
39 * The @read@ command takes the contents of stdin and puts it into the shell variable named on the command line.
40 * The @<<EOF@ notation means read each line on stdin and pipe it to the command, terminating on reading the line @EOF@.
41 * The @export@ command puts a local shell variable into the environment that will be inherited by child processes (e.g. the @arv@ client).
42
43 For your convenience you may add the declarations of @ARVADOS_API_HOST@ and @ARVADOS_API_TOKEN@ to the @~/.bashrc@ file on the system on which you intend to use the Arvados client.  If you have already put the variables into the environment with instructions above, you can use these commands to append the environment variables to your @~/.bashrc@:
44
45 bc. $ echo "export ARVADOS_API_HOST=$ARVADOS_API_HOST" >> ~/.bashrc
46 $ echo "export ARVADOS_API_TOKEN=$ARVADOS_API_TOKEN" >> ~/.bashrc
47