# Authorizing Square API in Astera

Square API is an HTTP-based API that follows REST standards. It allows you to manage the resources of your Square account by making requests to URLs representing those resources. You can configure Square API for use in Astera by providing its swagger definition using the *Import API* option in the REST API Browser.

1. After you have created the application in Square, go to *Manage Properties*.

![](/files/AUbCcdf4y3C0OjZPY0xc)

2. Now go to *OAuth* properties in the *Production* tab. Here, you have to provide the *Redirect URL* for the authorization callback.

{% hint style="info" %}
**Note:** Save Applicant ID and secret to use it later for Astera authentication.
{% endhint %}

![](/files/EM9VrzPYXbo0pfzhc0Ji)

3. Now create an integration project in Astera. Also, import the following swagger definition in the REST API Browser:

*Base Url:* <https://raw.githubusercontent.com/square/connect-api-specification/master/api.json>

![](/files/vlt18MiDePLKNucEt0E0)

4. Go to the Square’s shared action file’s (.sact) properties to authenticate it in Astera. Click here to learn more about how to work with APIs that require authentication.

![](/files/lc7moAVIUyxml65Rbsbm)

You can authorize Square API by using *Security Type* *OAuth 2* or *Bearer Token*. In this example, we will be authorizing using *OAuth 2*.

5. Set its *Security Type* as ‘OAuth 2’ and *Grant Type* as ‘Authentication Code’. Provide the application ID and secret that you had saved in step 2.

Click on *Request Token* to get the access token to Square API.

* *Auth Url:* [https://connect//squareup.com/oauth2/authorize](https://connect/squareup.com/oauth2/authorize)
* *Access Token Url*: <https://connect.squareup.com/oauth2/token>

![](/files/QXxwOcA8MwPK1MTrBdyJ)

*Additional Info*: You can modify your authorization by mentioning the names of only those permissions that you want to access from your Square account in Astera. In case you want to access all of them, leave the settings at default.

![](/files/QMMTWcTMKWNoh0L92u9R)

6. Once you get the access token, save the Shared Action file and you are ready to use Square API in Astera.

This concludes with authenticating the Square API in Astera.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.astera.com/astera-data-stack-v9/api-flows/api-consumption/authorize/authorizing-square-api-in-astera.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
