# Your First API Call

export const searchQueryParams = [
  {
    name: "time_frame",
    defaultValue: "24h",
    defaultActive: true,
  },
  {
    name: "limit",
    defaultValue: "10",
    defaultActive: true,
  },
  {
    name: "title",
    defaultValue: '"Software Engineer" OR "Data Scientist"',
    defaultActive: true,
  },
  {
    name: "location",
    defaultValue: '"New York, United States" OR "San Francisco, United States"',
    defaultActive: true,
  },
];

export const searchHeaders = [
  {
    name: "Authorization",
    defaultValue: "Bearer YOUR_API_KEY",
    defaultActive: true,
  },
];



Fantastic.jobs' API makes it easy to search active job listings with minimal delay.
To get started, let's search for `Software Engineer` or `Data Scientist` ATS jobs in
`New York, United States` or `San Francisco, United States` using the `title` and
`location` query parameters with `OR` to combine multiple values. We'll also limit
the response to `10` results from the last `24h`.

Use the playground below to send a `GET` request to
`https://data.fantastic.jobs/v1/active-ats` with your API key.

<OpenPlaygroundButton
  server="https://data.fantastic.jobs"
  method="get"
  url="/v1/active-ats"
  queryParams={searchQueryParams}
  headers={searchHeaders}
>
  Open in Playground
</OpenPlaygroundButton>

That's it! Open the playground, add your API key, and you should get back a filtered list of
ATS job listings that match this search.

## Run it in code

The same request, ready to drop into your project:

<CodeTabs>
  <CodeTabPanel
    language="bash"
    title="curl"
    code={`curl --request GET \\
  --get 'https://data.fantastic.jobs/v1/active-ats' \\
  --data-urlencode 'time_frame=24h' \\
  --data-urlencode 'limit=10' \\
  --data-urlencode 'title="Software Engineer" OR "Data Scientist"' \\
  --data-urlencode 'location="New York, United States" OR "San Francisco, United States"' \\
  --header 'Authorization: Bearer YOUR_API_KEY'`}
  />
  <CodeTabPanel
    language="javascript"
    title="Node.js"
    code={`const params = new URLSearchParams({
  time_frame: "24h",
  limit: "10",
  title: '"Software Engineer" OR "Data Scientist"',
  location: '"New York, United States" OR "San Francisco, United States"',
});

const response = await fetch(
  \`https://data.fantastic.jobs/v1/active-ats?\${params}\`,
  {
    method: "GET",
    headers: {
      Authorization: "Bearer YOUR_API_KEY",
    },
  }
);

const data = await response.json();
console.log(data);`}
  />
  <CodeTabPanel
    language="python"
    title="Python"
    code={`import requests

response = requests.get(
    "https://data.fantastic.jobs/v1/active-ats",
    params={
        "time_frame": "24h",
        "limit": "10",
        "title": '"Software Engineer" OR "Data Scientist"',
        "location": '"New York, United States" OR "San Francisco, United States"',
    },
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)

data = response.json()
print(data)`}
  />
</CodeTabs>

## Try another search

To test other searches, keep the same endpoint and change just the `title` and `location`
parameters in the playground.

:::note{title="How to structure the `location` parameter"}

`location` requires **full names** (no abbreviations), for example:  
`California, United States`.\
Combine multiple locations with `OR`, quoting multi-word values:\
`"San Francisco" OR "New York"`.


For UK searches, include the constituent-country when searchin on a city level. For example: `Birmingham, England, United Kingdom`.


:::

## What's next?

Check out the full [`/api`](/api) reference to explore more filters like `organization`, `source`,
`seniority`, and AI-enriched fields.
